mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-13 22:38:04 +00:00
25 lines
377 B
Go
25 lines
377 B
Go
|
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))
|
||
|
}
|