Commit 13d3707d authored by Eric Myhre's avatar Eric Myhre

schema compiler: example of how migrating tests to new compiler will look.

This'll probably be a lot of grind to refactor, but otherwise isn't
a huge jump semantically.

I waffled on sprinting straight ahead to writing schema DMT as JSON,
and using those as the test fixture input.  On the one hand: it would
be nice to get that much closer to purely textual test fixtures.
On the other hand, it's really verbose, and I don't want to (long run,
we'll use schema DSL for this, and while we'll also save the DMT
fixtures, they should ideally probably mostly be generated and just
human-checked rather than human-penned);
and also, since we don't have implicits implemented correctly yet,
we'd need to update all that JSON again anyway once that feature is
complete... which pushes it overall to a net "nah".
parent a50802c3
......@@ -14,16 +14,17 @@ import (
func TestListsContainingMaybe(t *testing.T) {
t.Parallel()
ts := schema.TypeSystem{}
ts.Init()
tsc := schema.Compiler{}
tsc.Init()
adjCfg := &AdjunctCfg{
maybeUsesPtr: map[schema.TypeName]bool{},
}
ts.Accumulate(schema.SpawnString("String"))
ts.Accumulate(schema.SpawnList("List__String",
"String", false))
ts.Accumulate(schema.SpawnList("List__nullableString",
"String", true))
tsc.TypeString("String")
tsc.TypeList("List__String",
"String", false)
tsc.TypeList("List__nullableString",
"String", true)
ts := tsc.MustCompile()
test := func(t *testing.T, getPrototypeByName func(string) ipld.NodePrototype) {
t.Run("non-nullable", func(t *testing.T) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment