This repository has been archived on 2015-04-29. You can view files and clone it, but cannot push or open issues or pull requests.
jsh/common_test.go
2014-09-04 02:49:55 -04:00

22 lines
536 B
Go

package jsh
import "testing"
func TestToJson(t *testing.T) {
fixture := JshOutput{[]string{}, []string{}}
json := fixture.ToJson()
expected := `{"StdOut":[],"StdErr":[]}`
actual := *json
if actual != expected {
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)
}
}