Documentation ¶
Index ¶
- Variables
- func BenchmarkSpec_Marshal_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
- func BenchmarkSpec_Marshal_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
- func BenchmarkSpec_Unmarshal_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
- func BenchmarkSpec_Unmarshal_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
- func BenchmarkSpec_Walk_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
- func BenchmarkSpec_Walk_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
- func SchemaTestAll(t *testing.T, forTest func(name string) []EngineSubtest)
- func SchemaTestLinks(t *testing.T, engine Engine)
- func SchemaTestListsContainingLists(t *testing.T, engine Engine)
- func SchemaTestListsContainingMaybe(t *testing.T, engine Engine)
- func SchemaTestMapsContainingMaps(t *testing.T, engine Engine)
- func SchemaTestMapsContainingMaybe(t *testing.T, engine Engine)
- func SchemaTestMapsWithComplexKeys(t *testing.T, engine Engine)
- func SchemaTestRequiredFields(t *testing.T, engine Engine)
- func SchemaTestScalars(t *testing.T, engine Engine)
- func SchemaTestStructNesting(t *testing.T, engine Engine)
- func SchemaTestStructReprListPairs(t *testing.T, engine Engine)
- func SchemaTestStructReprStringjoin(t *testing.T, engine Engine)
- func SchemaTestStructReprTuple(t *testing.T, engine Engine)
- func SchemaTestStructsContainingMaybe(t *testing.T, engine Engine)
- func SchemaTestUnionKeyed(t *testing.T, engine Engine)
- func SchemaTestUnionKeyedComplexChildren(t *testing.T, engine Engine)
- func SchemaTestUnionKeyedReset(t *testing.T, engine Engine)
- func SchemaTestUnionKinded(t *testing.T, engine Engine)
- func SchemaTestUnionStringprefix(t *testing.T, engine Engine)
- func SpecBenchmarkMapStrInt_25n_AssembleEntry(b *testing.B, np datamodel.NodePrototype)
- func SpecBenchmarkMapStrInt_25n_AssembleStandard(b *testing.B, np datamodel.NodePrototype)
- func SpecBenchmarkMapStrInt_25n_Iteration(b *testing.B, np datamodel.NodePrototype)
- func SpecBenchmarkMapStrInt_3n_AssembleEntry(b *testing.B, np datamodel.NodePrototype)
- func SpecBenchmarkMapStrInt_3n_AssembleStandard(b *testing.B, np datamodel.NodePrototype)
- func SpecBenchmarkMapStrInt_3n_Iteration(b *testing.B, np datamodel.NodePrototype)
- func SpecTestBytes(t *testing.T, np datamodel.NodePrototype)
- func SpecTestListString(t *testing.T, np datamodel.NodePrototype)
- func SpecTestMapStrInt(t *testing.T, np datamodel.NodePrototype)
- func SpecTestMapStrListStr(t *testing.T, np datamodel.NodePrototype)
- func SpecTestMapStrMapStrInt(t *testing.T, np datamodel.NodePrototype)
- func SpecTestString(t *testing.T, np datamodel.NodePrototype)
- type Engine
- type EngineSubtest
Constants ¶
This section is empty.
Variables ¶
var NodeContentEquals = &nodeContentEqualsChecker{}
NodeContentEquals checks whether two nodes have equal content by first encoding them via printer.Sprint, then checking that the generated encodings are identical.
See: printer.Sprint.
Functions ¶
func BenchmarkSpec_Marshal_Map3StrInt ¶
func BenchmarkSpec_Marshal_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
func BenchmarkSpec_Marshal_MapNStrMap3StrInt ¶
func BenchmarkSpec_Marshal_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
func BenchmarkSpec_Unmarshal_Map3StrInt ¶
func BenchmarkSpec_Unmarshal_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
func BenchmarkSpec_Unmarshal_MapNStrMap3StrInt ¶
func BenchmarkSpec_Unmarshal_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
func BenchmarkSpec_Walk_Map3StrInt ¶
func BenchmarkSpec_Walk_Map3StrInt(b *testing.B, np datamodel.NodePrototype)
func BenchmarkSpec_Walk_MapNStrMap3StrInt ¶
func BenchmarkSpec_Walk_MapNStrMap3StrInt(b *testing.B, np datamodel.NodePrototype)
func SchemaTestAll ¶ added in v0.11.0
func SchemaTestAll(t *testing.T, forTest func(name string) []EngineSubtest)
func SchemaTestLinks ¶ added in v0.11.0
func SchemaTestListsContainingLists ¶ added in v0.10.0
TestListsContainingLists is probing *two* things:
- that lists can nest, obviously
- that representation semantics are held correctly when we recurse, both in builders and in reading
To cover that latter situation, this depends on structs (so we can use rename directives on the representation to make it distinctive).
func SchemaTestListsContainingMaybe ¶ added in v0.10.0
func SchemaTestMapsContainingMaps ¶ added in v0.10.0
TestMapsContainingMaps is probing *two* things:
- that maps can nest, obviously
- that representation semantics are held correctly when we recurse, both in builders and in reading
To cover that latter situation, this depends on structs (so we can use rename directives on the representation to make it distinctive).
func SchemaTestMapsContainingMaybe ¶ added in v0.10.0
func SchemaTestMapsWithComplexKeys ¶ added in v0.10.0
func SchemaTestRequiredFields ¶ added in v0.10.0
func SchemaTestScalars ¶ added in v0.11.0
func SchemaTestStructNesting ¶ added in v0.10.0
func SchemaTestStructReprListPairs ¶ added in v0.21.0
func SchemaTestStructReprStringjoin ¶ added in v0.10.0
TestStructReprStringjoin exercises... well, what it says on the tin.
These should pass even if the natural map representation doesn't. No maybes are exercised.
func SchemaTestStructReprTuple ¶ added in v0.10.0
func SchemaTestStructsContainingMaybe ¶ added in v0.10.0
TestStructsContainingMaybe checks all the variations of "nullable" and "optional" on struct fields. It does this twice: once for the child maybes being implemented with pointers, and once with maybes implemented as embeds. The child values are scalars.
Both type-level generic build and access as well as representation build and access are exercised; the representation used is map (the native representation for structs).
func SchemaTestUnionKeyed ¶ added in v0.10.0
func SchemaTestUnionKeyedComplexChildren ¶ added in v0.10.0
Test keyed unions again, but this time with more complex types as children.
The previous tests used scalar types as the children; this exercises most things, but also has a couple (extremely non-obvious) simplifications: namely, because the default representation for strings are "natural" representations, the ReprAssemblers are actually aliases of the type-level Assemblers! Aaaand that makes a few things "work" by coincidence that wouldn't otherwise fly.
func SchemaTestUnionKeyedReset ¶ added in v0.10.0
TestUnionKeyedReset puts a union inside a list, so that we can use the list's reuse of assembler as a test of the assembler's reset feature. The value inside the union is also more complex than a scalar value so that we test resetting gets passed down, too.
func SchemaTestUnionKinded ¶ added in v0.10.0
func SchemaTestUnionStringprefix ¶ added in v0.10.0
func SpecBenchmarkMapStrInt_25n_AssembleEntry ¶
func SpecBenchmarkMapStrInt_25n_AssembleEntry(b *testing.B, np datamodel.NodePrototype)
func SpecBenchmarkMapStrInt_25n_AssembleStandard ¶
func SpecBenchmarkMapStrInt_25n_AssembleStandard(b *testing.B, np datamodel.NodePrototype)
func SpecBenchmarkMapStrInt_25n_Iteration ¶
func SpecBenchmarkMapStrInt_25n_Iteration(b *testing.B, np datamodel.NodePrototype)
func SpecBenchmarkMapStrInt_3n_AssembleEntry ¶
func SpecBenchmarkMapStrInt_3n_AssembleEntry(b *testing.B, np datamodel.NodePrototype)
func SpecBenchmarkMapStrInt_3n_AssembleStandard ¶
func SpecBenchmarkMapStrInt_3n_AssembleStandard(b *testing.B, np datamodel.NodePrototype)
func SpecBenchmarkMapStrInt_3n_Iteration ¶
func SpecBenchmarkMapStrInt_3n_Iteration(b *testing.B, np datamodel.NodePrototype)
func SpecTestBytes ¶ added in v0.16.0
func SpecTestBytes(t *testing.T, np datamodel.NodePrototype)
func SpecTestListString ¶
func SpecTestListString(t *testing.T, np datamodel.NodePrototype)
func SpecTestMapStrInt ¶
func SpecTestMapStrInt(t *testing.T, np datamodel.NodePrototype)
func SpecTestMapStrListStr ¶
func SpecTestMapStrListStr(t *testing.T, np datamodel.NodePrototype)
func SpecTestMapStrMapStrInt ¶
func SpecTestMapStrMapStrInt(t *testing.T, np datamodel.NodePrototype)
func SpecTestString ¶
func SpecTestString(t *testing.T, np datamodel.NodePrototype)
Types ¶
type Engine ¶ added in v0.10.0
type Engine interface { Init(t *testing.T, ts schema.TypeSystem) PrototypeByName(name string) datamodel.NodePrototype }
Engine describes the interface that can be supplied to run tests on schemas.
The PrototypeByName function can get its job done using only interface types that we already know from outside any generated code, so you can write tests that have no _compile time_ dependency on the generated code. This makes it easier for IDEs and suchlike to help you write and check the test functions.
Ask for prototypes using the type name alone (no package prefix); their representation prototypes can be obtained by appending ".Repr".
type EngineSubtest ¶ added in v0.11.0
Source Files ¶
- byteSpecs.go
- checkers.go
- listSpecs.go
- mapBenchmarks.go
- mapFixtures.go
- mapSpecs.go
- marshalBenchmarks.go
- schema.go
- schemaLinks.go
- schemaLists.go
- schemaMaps.go
- schemaScalars.go
- schemaStruct.go
- schemaStructReprListpairs.go
- schemaStructReprStringjoin.go
- schemaStructReprTuple.go
- schemaStructsContainingMaybe.go
- schemaUnions.go
- schemaUnionsKinded.go
- schemaUnionsStringprefix.go
- stringSpecs.go
- testEngine.go
- testcase.go
- testutil.go
- traversalBenchmarks.go
- unmarshalBenchmarks.go
- util.go