Test that JST sub-tables align at a distance.
They do.
@@ -61,3 +61,27 @@ func TestSubTables(t *testing.T) {
Wish(t, Marshal(n, &buf), ShouldEqual, nil)
Wish(t, buf.String(), ShouldEqual, fixture)
}
+
+func TestSubTablesCorrelated(t *testing.T) {
+ fixture := Dedent(`
+ [
+ {"path": "./foo", "moduleName": "whiz.org/teamBar/foo", "status": "changed"},
+ {"path": "./baz", "moduleName": "whiz.org/teamBar/baz", "status": "green",
+ "subtable": [
+ {"frob": "zozzle", "zim": "boink"},
+ {"frob": "narf", "zim": "zamf"}
+ ]},
+ {"path": "./quxx", "moduleName": "example.net/quxx", "status": "lit",
+ "subtable": [
+ {"frob": "evenlonger", "zim": "boink"},
+ {"frob": "narf", "zim": "zamf"}
+ ]}
+ ]`)
+ nb := basicnode.Style.Any.NewBuilder()
+ Require(t, dagjson.Decoder(nb, bytes.NewBufferString(fixture)), ShouldEqual, nil)
+ n := nb.Build()
+
+ var buf bytes.Buffer
+ Wish(t, Marshal(n, &buf), ShouldEqual, nil)
+ Wish(t, buf.String(), ShouldEqual, fixture)
+}
