From 3fff4fbcd0d09189480071018092ed665ca17398 Mon Sep 17 00:00:00 2001 From: Manik Rana Date: Tue, 16 Jan 2024 20:19:33 +0530 Subject: [PATCH] tests: add tests for go/json2/marshal.go Signed-off-by: Manik Rana --- go/json2/marshal_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/go/json2/marshal_test.go b/go/json2/marshal_test.go index 96b7f508d73..620347cafb0 100644 --- a/go/json2/marshal_test.go +++ b/go/json2/marshal_test.go @@ -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) + } +}