Skip to content

Commit

Permalink
tests: add tests for go/json2/marshal.go
Browse files Browse the repository at this point in the history
Signed-off-by: Manik Rana <[email protected]>
  • Loading branch information
Maniktherana committed Jan 16, 2024
1 parent c1f9c80 commit 3fff4fb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions go/json2/marshal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,19 @@ func TestMarshalPB(t *testing.T) {
t.Errorf("MarshalPB(col): %q, want %q", b, want)
}
}

func TestMarshalIndentPB(t *testing.T) {
col := &vschemapb.Column{
Name: "c1",
Type: querypb.Type_VARCHAR,
}
indent := " "
b, err := MarshalIndentPB(col, indent)
if err != nil {
t.Fatal(err)
}
want := "{\n \"name\": \"c1\",\n \"type\": \"VARCHAR\"\n}"
if string(b) != want {
t.Errorf("MarshalIndentPB(col, indent): %q, want %q", b, want)
}
}

0 comments on commit 3fff4fb

Please sign in to comment.