| 1 | package execution_test |
| 2 | |
| 3 | import ( |
| 4 | "github.com/tomwright/dasel/v3/model" |
| 5 | _ "github.com/tomwright/dasel/v3/parsing/json" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | func TestFuncStringify(t *testing.T) { |
| 10 | t.Run("json with explicit value", testCase{ |
| 11 | s: `stringify("json", {"a": 1})`, |
| 12 | out: model.NewStringValue(`{"a":1}`), |
| 13 | }.run) |
| 14 | t.Run("json chained", testCase{ |
| 15 | s: `{"a": 1}.stringify("json")`, |
| 16 | out: model.NewStringValue(`{"a":1}`), |
| 17 | }.run) |
| 18 | t.Run("roundtrip", testCase{ |
| 19 | s: `parse("json", stringify("json", {"a": 1})).a`, |
| 20 | out: model.NewIntValue(1), |
| 21 | }.run) |
| 22 | } |