Browse Source

master > master: codego Tippfehler

master
RD 1 year ago
parent
commit
6641946bad
  1. 8
      codego/core/utils/utils_test.go

8
codego/core/utils/utils_test.go

@ -21,10 +21,10 @@ func TestJsonToArrayOfStrings(test *testing.T) {
var result []string
utils.JsonToArrayOfStrings("[]", &result)
assert.Equal([]string{}, result)
utils.JsonToArrayOfStrings("[ \"ganimed\" ]", &result)
assert.Equal([]string{"ganimed"}, result)
utils.JsonToArrayOfStrings("[ \"ganimed\", \"io\" ]", &result)
assert.Equal([]string{"ganimed", "io"}, result)
utils.JsonToArrayOfStrings("[ \"ganymed\" ]", &result)
assert.Equal([]string{"ganymed"}, result)
utils.JsonToArrayOfStrings("[ \"ganymed\", \"io\" ]", &result)
assert.Equal([]string{"ganymed", "io"}, result)
assert.Panics(func() { utils.JsonToArrayOfStrings("[ 178 ]", &result) }, "Should panic if converting not a JSON-encoded array of strings!")
assert.Panics(func() { utils.JsonToArrayOfStrings("true", &result) }, "Should panic if converting not a JSON-encoded array of strings!")
assert.Panics(func() { utils.JsonToArrayOfStrings("", &result) }, "Should panic if converting not a JSON-encoded array of strings!")

Loading…
Cancel
Save