Improve TestToJson.
This commit is contained in:
parent
c140ec6a7d
commit
65c29fef11
@ -5,9 +5,17 @@ import "testing"
|
|||||||
func TestToJson(t *testing.T) {
|
func TestToJson(t *testing.T) {
|
||||||
fixture := JshOutput{[]string{}, []string{}}
|
fixture := JshOutput{[]string{}, []string{}}
|
||||||
json := fixture.ToJson()
|
json := fixture.ToJson()
|
||||||
expected := "{\"StdOut\":[],\"StdErr\":[]}"
|
expected := `{"StdOut":[],"StdErr":[]}`
|
||||||
actual := *json
|
actual := *json
|
||||||
if actual != expected {
|
if actual != expected {
|
||||||
t.Error("Empty fixture did not match:\n%s != %s", expected, actual)
|
t.Errorf("Empty fixture did not match:\n%s != %s", expected, actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
fixture = JshOutput{[]string{"potato!"}, []string{}}
|
||||||
|
json = fixture.ToJson()
|
||||||
|
expected = `{"StdOut":["potato!"],"StdErr":[]}`
|
||||||
|
actual = *json
|
||||||
|
if actual != expected {
|
||||||
|
t.Errorf("JSON output did not match:\n%s != %s", expected, actual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user