Skip to content

Commit

Permalink
Update json_stream_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshi-garg1 authored Jan 23, 2025
1 parent 9905e02 commit 424c42d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions api/json/json_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,39 @@ func TestUnmarshalJSON(t *testing.T) {
err = m.UnmarshalJSON([]byte(`{"key1":"value1","key2":"value2"}`))
assert.Equal(t, nil, err)
}

func TestNonSpace(t *testing.T) {
var b byte = 'a'
value := nonSpace([]byte{b})
assert.Equal(t, true, value)
}

func TestSetIndent(t *testing.T) {

Check failure on line 283 in api/json/json_stream_test.go

View workflow job for this annotation

GitHub Actions / Golang Validation / Lint golang code

unused-parameter: parameter 't' seems to be unused, consider removing or renaming it as _ (revive)
enc := &Encoder{
w: bytes.NewBuffer(nil),
escapeHTML: false,
}
enc.SetIndent("", "")
}

func TestContains(t *testing.T) {
var tag tagOptions = ""

Check failure on line 292 in api/json/json_stream_test.go

View workflow job for this annotation

GitHub Actions / Golang Validation / Lint golang code

var-declaration: should drop = "" from declaration of var tag; it is the zero value (revive)
value := tag.Contains("")
assert.Equal(t, false, value)

tag = "string"
value = tag.Contains("string")
assert.Equal(t, true, value)

tag = "string,string1,string2"
value = tag.Contains("string1")
assert.Equal(t, true, value)
}

func TestParseTag(t *testing.T) {
value, _ := parseTag("string,string1")
assert.Equal(t, "string", value)

value, _ = parseTag("string")
assert.Equal(t, "string", value)
}

0 comments on commit 424c42d

Please sign in to comment.