aboutsummaryrefslogtreecommitdiff
path: root/lib/std/json/test.zig
AgeCommit message (Collapse)Author
2022-07-23std.json: Fix parsing of large numbersominitay
Numbers greater than about 2^53 are encoded as strings in JSON. std.json.parseInternal previously errored out in this condition.
2022-07-07std.json: move tests to json/test.zig fileAndrew Kelley
This accomplishes two things: * Works around #8442 by putting stage1-specific logic in to disable all the std.json tests. * Slightly reduces installation size of zig since std lib files ending in "test.zig" are excluded from being installed.
2021-08-24remove redundant license headers from zig standard libraryAndrew Kelley
We already have a LICENSE file that covers the Zig Standard Library. We no longer need to remind everyone that the license is MIT in every single file. Previously this was introduced to clarify the situation for a fork of Zig that made Zig's LICENSE file harder to find, and replaced it with their own license that required annual payments to their company. However that fork now appears to be dead. So there is no need to reinforce the copyright notice in every single file.
2021-05-13std/json: Fix premature closing brace being considered valid JSONMatthew Borkowski
return error from StreamingParser when reading closing brace when expecting value for an object key
2021-05-08std: update usage of std.testingVeikka Tuominen
2021-04-11std.meta: add isErrorxackus
2021-04-04Tidy-up in json test module (#8431)Lewis Gaul
* Switch json testing 'roundTrip()' to use FixedBufferStream, improve error handling, remove comptime from param * Add 'try' to calls to roundTrip() that can now return an error * Remove comptime from params in json testing, replace expect(false) with letting error propagate * Add 'try' to calls to ok() that can now return an error Co-authored-by: Lewis Gaul <legaul@cisco.com>
2021-04-04Switch std.json to use an ordered hashmapLewis Gaul
2020-12-31Year++Frank Denis
2020-12-08std.json: unreachable -> expect in testsxackus
2020-11-02std: Fix json utf{8,16} decoding on BE targetsLemonBoy
Byteswap some values when LE ordering is required.
2020-08-20add license header to all std lib filesAndrew Kelley
add SPDX license identifier copyright ownership is zig contributors
2020-04-24Add mips support to standard libraryTimon Kruiper
2020-03-29fix overflow in parseFloatxackus
2020-02-12Convert a lot of json tests to use testing.allocatorBenjamin Feng
2020-01-07json: disallow overlong and out-of-range UTF-8hryx
Fixes #2379 = Overlong (non-shortest) sequences UTF-8's unique encoding scheme allows for some Unicode codepoints to be represented in multiple ways. For any of these characters, the spec forbids all but the shortest form. These disallowed longer sequences are called "overlong". As an interesting side effect of this rule, the bytes C0 and C1 never appear in valid UTF-8. = Codepoint range UTF-8 disallows representation of codepoints beyond U+10FFFF, which is the highest character which can be encoded in UTF-16. Because a 4-byte sequence is capable of resulting in such characters, they must be explicitly rejected. This rule also has an interesting side effect, which is that bytes F5 to FF never appear. = References Detecting an overlong version of a codepoint could get gnarly, but luckily The Unicode Consortium did the hard work by creating this handy table of valid byte sequences: https://unicode.org/versions/corrigendum1.html I thought this mapped nicely to the parser's state machine, so I rearranged the relevant states to make use of it.
2020-01-06zig fmt and update `extern fn` to `callconv(.C)`Andrew Kelley
2019-11-11Stricter tests for non-streaming parserxackus
2019-11-11Fix bugs in JSON parserxackus
Make comments into documentation where appropriate
2019-11-11json: surrogate pair supportxackus
test json.Parser with tests used for json.Streaming parser (some don't pass yet)
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221