Skip to content

Commit

Permalink
Merge pull request #6280 from hs0210/work
Browse files Browse the repository at this point in the history
Add unit test for func stringMapToString.
  • Loading branch information
sougou authored Jun 15, 2020
2 parents 9b187c8 + 21775bd commit 34be289
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions go/stats/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,13 @@ func TestDropVariable(t *testing.T) {
_ = NewGaugesWithSingleLabel("dropTest", "help", "label")
_ = NewGaugesWithSingleLabel("dropTest", "help", "label")
}

func TestStringMapToString(t *testing.T) {
expected1 := "{\"aaa\": \"111\", \"bbb\": \"222\"}"
expected2 := "{\"bbb\": \"222\", \"aaa\": \"111\"}"
got := stringMapToString(map[string]string{"aaa": "111", "bbb": "222"})

if got != expected1 && got != expected2 {
t.Errorf("expected %v or %v, got %v", expected1, expected2, got)
}
}

0 comments on commit 34be289

Please sign in to comment.