yq/json_converter_test.go

25 lines
377 B
Go
Raw Normal View History

2015-10-10 23:00:22 +00:00
package main
import (
"testing"
)
func TestJsonToString(t *testing.T) {
var data = parseData(`
---
b:
c: 2
`)
assertResult(t, "{\"b\":{\"c\":2}}", jsonToString(data))
}
func TestJsonToString_withArray(t *testing.T) {
var data = parseData(`
---
b:
- item: one
- item: two
`)
assertResult(t, "{\"b\":[{\"item\":\"one\"},{\"item\":\"two\"}]}", jsonToString(data))
}