| ... | ... | @@ -245,6 +245,23 @@ test "Value.jsonStringify" { |
| 245 | 245 | } |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | test "parseFromValue(std.json.Value,...)" { |
| 249 | const str = |
| 250 | \\{ |
| 251 | \\ "int": 32, |
| 252 | \\ "float": 3.2, |
| 253 | \\ "str": "str", |
| 254 | \\ "array": [3, 2], |
| 255 | \\ "object": {} |
| 256 | \\} |
| 257 | ; |
| 258 | |
| 259 | const parsed_tree = try parseFromSlice(Value, testing.allocator, str, .{}); |
| 260 | defer parsed_tree.deinit(); |
| 261 | const tree = try parseFromValueLeaky(Value, parsed_tree.arena.allocator(), parsed_tree.value, .{}); |
| 262 | try testing.expect(std.meta.eql(parsed_tree.value, tree)); |
| 263 | } |
| 264 | |
| 248 | 265 | test "polymorphic parsing" { |
| 249 | 266 | if (true) return error.SkipZigTest; // See https://github.com/ziglang/zig/issues/16108 |
| 250 | 267 | const doc = |