Commit a96a7f02 authored by Will Scott's avatar Will Scott

Add test for sufficiency

parent 58cad300
......@@ -171,4 +171,32 @@ func TestStructsContainingMaybe(t *testing.T) {
}
})
})
genAndCompileAndTest(t, "stroct3", "main", ts, adjCfg, func(t *testing.T, getPrototypeByName func(string) ipld.NodePrototype) {
t.Run("insufficient", func(t *testing.T) {
nrp := getPrototypeByName("Stroct")
t.Run("typed-create", func(t *testing.T) {
b := nrp.NewBuilder()
mb, err := b.BeginMap(0)
if err != nil {
t.Fatal(err)
}
v, err := mb.AssembleEntry("f1")
if err != nil {
t.Fatal(err)
}
v.AssignString("v1")
shouldPanicOnBuild := func(t *testing.T) {
defer func() {
if r := recover(); r == nil {
t.Errorf("The code did not panic")
}
}()
_ = b.Build()
}
shouldPanicOnBuild(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