22 lines
534 B
Go
22 lines
534 B
Go
package jsh
|
|
|
|
import "testing"
|
|
|
|
func TestToJson(t *testing.T) {
|
|
fixture := JshFrame{[]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 = JshFrame{[]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)
|
|
}
|
|
}
|