Documentation ¶
Overview ¶
Token stream test fixtures. This is a public package because it is used by tests in the `json`, `cbor`, and `obj` packages. It should not be seen in the imports outside of testing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var SequenceMap map[string]Sequence
Sequences indexed by title.
var Sequences []Sequence
Functions ¶
func StompLengths ¶
StompLengths in-place mutates all tokens to have length=-1 if length is a relevant property for that Token.Type, and to 0 otherwise.
Types ¶
type Sequence ¶
func (Sequence) Append ¶
Returns a copy of the sequence with the given token appened. This is mostly useful to test failure modes, like appending an invalid token at the end so decoder lengths match up.
func (Sequence) Clone ¶
Returns a copy of the sequence with no shared memory. This is useful when writing tests that use almost-the-fixture but you want to change one token.
func (Sequence) SansLengthInfo ¶
Returns a copy of the sequence with all length info at the start of maps and arrays stripped. Use this when testing e.g. json and cbor-in-stream-mode, which doesn't know lengths.