node/bindnode: also run TestPrototype with just schemas
Fixes the TODO near the end of the test.
The changes are very small, if one ignores whitespace.
@@ -157,10 +157,19 @@ func TestPrototype(t *testing.T) {
for _, test := range prototypeTests {
test := test // don't reuse the range var
- t.Run(test.name, func(t *testing.T) {
+ for _, onlySchema := range []bool{false, true} {
+ suffix := ""
+ if onlySchema {
+ suffix = "_onlySchema"
+ }
+ t.Run(test.name+suffix, func(t *testing.T) {
t.Parallel()
schemaType := loadSchema(t, test.schemaSrc)
+
+ if onlySchema {
+ test.ptrType = nil
+ }
proto := bindnode.Prototype(test.ptrType, schemaType)
wantEncoded := compactJSON(t, test.prettyDagJSON)
@@ -172,8 +181,7 @@ func TestPrototype(t *testing.T) {
// Verify that doing a dag-json encode of the non-repr node works.
_ = dagjsonEncode(t, node)
-
- // TODO: also check that just using the schema works?
})
}
}
+}
