| # generated from the original tests. |
| # Henceforth it may be nicer to group tests into separate files. |
| -- in.cue -- |
| import "encoding/json" |
| |
| t1: json.Validate("{\"a\":10}", {b:string}) |
| t2: json.Validate("{\"a\":10}", {a:<3}) |
| t3: json.Valid("1") |
| t4: json.Compact("[1, 2]") |
| t5: json.Indent(#"{"a": 1, "b": 2}"#, "", " ") |
| t6: json.Unmarshal("1") |
| t7: json.MarshalStream([{a: 1}, {b: 2}]) |
| t8: { |
| x: int |
| y: json.Marshal({a: x}) |
| } |
| t9: json.MarshalStream([{a: 1}, {b: int | *2}]) |
| -- out/json -- |
| Errors: |
| a: error in call to encoding/json.Validate: invalid value 10 (out of bound <3): |
| ./in.cue:4:5 |
| ./in.cue:4:36 |
| json.Validate:1:6 |
| |
| Result: |
| import "encoding/json" |
| |
| t1: true |
| t2: _|_ // error in call to encoding/json.Validate: a: invalid value 10 (out of bound <3) |
| t3: true |
| t4: "[1,2]" |
| t5: """ |
| { |
| "a": 1, |
| "b": 2 |
| } |
| """ |
| t6: 1 |
| t7: """ |
| {"a":1} |
| {"b":2} |
| |
| """ |
| t8: { |
| x: int |
| y: json.Marshal({ |
| a: x |
| }) |
| } |
| t9: """ |
| {"a":1} |
| {"b":2} |
| |
| """ |
| |