| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
We can’t do this by porting to g_autoptr(), because json-glib needs to
be buildable using MSVC. Sad panda.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
https://gitlab.gnome.org/GNOME/json-glib/issues/30
(cherry picked from commit 43b9703970a6d5f2fc53f828ab8d29195ab01583)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If parsing an empty document, it’s allowed to return NULL from
json_parser_get_root(). This was broken for immutable parsers when
immutability support was added (an assertion fails). Fix that, and also
document that json_parser_get_root() may return NULL.
Do the same for json_parser_steal_root() too, which is another way that
the root node may be NULL.
Add a unit test.
Signed-off-by: Philip Withnall <withnall@endlessm.com>
(cherry picked from commit ef5707cd0b8d1a1a4ab4edf9ae58c7b3176ef93b)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
|
|
|
|
|
|
| |
Direct comparison should never be used for floating point values.
Fixes #27 and #28.
|
|
|
|
|
| |
We do compare floating point values elsewhere in our code, so we should
ensure that we're doing that with a certain amount of fuzziness.
|
|
|
|
|
|
| |
In order to be resilient towards future API bumps, we should have very
few places that deal with the API version encoded inside paths and file
names.
|
|
|
|
|
| |
Avoid cluttering the source directories, and makes finding things
easier.
|
|
|
|
| |
Use variables for common values, instead of duplicating them.
|
|
|
|
|
|
| |
GTest can use environment variables to find the test data in the source
and build directory, so we don't need to copy files around using Python
scripts.
|
|
|
|
|
|
|
| |
This allows finding Python3 on Windows, in order to build and run the
tests.
https://bugzilla.gnome.org/show_bug.cgi?id=780550
|
|
|
|
|
| |
We need to point to the binary, but we're using the wrong name for the
Exec key.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=758580
|
|
|
|
| |
We use Meson to build JSON-GLib, now.
|
|
|
|
|
|
| |
We should install our tests in order to get them executed in
environments like GNOME Continuous and other continuous delivery
systems.
|
|
|
|
|
|
| |
Clean up the coding style, and make it a bit more idiomatic.
https://bugzilla.gnome.org/show_bug.cgi?id=773603
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=773603
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When converting json to its string representation, whole-doubles (such
as 1.0) would be converted into strings without decimals ("1"). That can
be inconvenient e.g. when converting from/to GVariants.
To avoid this, append '.0' to the string representation for doubles if
they lost their decimals in the conversion.
Also add / update unit tests for this.
https://bugzilla.gnome.org/show_bug.cgi?id=753763
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 028e540 disallowed empty member names in objects, however
they are unfortunately valid JSON. This patch reenables an empty
string as a member name.
Tests are updated to allow the empty string case, and to test
the use of an empty string in generation, iteration etc.
https://bugzilla.gnome.org/show_bug.cgi?id=747279
|
|
|
|
|
|
|
|
|
|
|
| |
Add an immutable mode to JsonNode, JsonObject, JsonArray and JsonValue.
This is an optional mode which objects enter by calling json_*_seal().
It is a one-way transition, which means that we can build and manipulate
objects as much as desired, before sealing them and enjoying the
benefits of immutable objects: no need to take copies when handling
them, persistent hash values (still to be implemented).
https://bugzilla.gnome.org/show_bug.cgi?id=756121
|
|
|
|
|
| |
Just like we detect trailing commas, we should also detect missing ones
to avoid parsing invalid JSON successfully.
|
|
|
|
|
|
|
|
|
|
| |
This is a stack-allocated iterator object similar to GHashTableIter
which allows allocation-free iteration over the members in a JsonObject.
It differs from json_object_foreach_member() in the order in which it
iterates — for JsonObjectIter the order is undefined.
https://bugzilla.gnome.org/show_bug.cgi?id=755509
|
|
|
|
|
|
| |
GLib 2.46.0 forbids this and so the testsuite fails.
https://bugzilla.gnome.org/show_bug.cgi?id=755977
|
|
|
|
|
|
|
|
|
| |
The json gvariant serializer encodes whole number doubles without
a dot. The deserializer needs to be able to parse these as well.
Fix problem, and add test cases.
https://bugzilla.gnome.org/show_bug.cgi?id=724319
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes the case where, with nested objects, we call:
json_reader_read_member (reader, "outer");
// json_reader_get_member_name (reader) == "outer"
json_reader_read_member (reader, "inner");
// json_reader_get_member_name (reader) == "inner"
// do something useful
json_reader_end_member (reader);
but at the end, the following assertion no longer holds:
// json_reader_get_member_name (reader) == "outer"
even though the JsonReader state should have been reset after ending the
inner node.
Fix it by maintaining a stack of member names. This works with both
json_reader_read_member() and json_reader_read_element(). Updates to the
unit tests are included.
https://bugzilla.gnome.org/show_bug.cgi?id=741824
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=730425
|
| |
|
|
|
|
| |
Fixes compilation in cases where builddir != srcdir.
|
|
|
|
| |
All the platforms and build system we support have a config.h header.
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=723428
|
|
|
|
| |
Instead of sizeof(array)/sizeof(type).
|
|
|
|
|
|
|
|
|
| |
Consider the following JSON: ["123"]
Trying to convert it to GVariant with signature "(i)" would previously fail,
as string-to-number conversions weren't implemented. This patch implements
string-to-number and string-to-boolean conversions.
https://bugzilla.gnome.org/show_bug.cgi?id=707382
|
|
|
|
|
|
|
| |
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Conflicts:
json-glib/tests/path.c
|
|
|
|
| |
And use g_test_build_filename().
|
|
|
|
|
|
|
| |
Instead of our homegrown solution. This should fix the regression in the
installed tests case.
Original patch by: Colin Walters <walters@verbum.org>
|
|
|
|
|
| |
We depend on a new version of GLib, so we can remove a bunch of old
version checks.
|
|
|
|
|
| |
Instead of using the old GLib test harness, we should use the newly
added TAP support and the TAP driver inside autotools.
|
|
|
|
|
|
|
| |
See https://live.gnome.org/GnomeGoals/InstalledTests for more
information.
It's still possible to run `make check` with locally uninstalled tests.
|
|
|
|
|
| |
Run each expression as a separate unit, so we can catch errors more
quickly and easily.
|
| |
|
|
|
|
|
|
|
| |
This will allow adding negative tests to JsonPath.
The tests will only be caught when compiling the query; an invalid query
won't return a match, so there's no point to check matches.
|
|
|
|
|
| |
Similar to the fix that went in commit path e348b1fa, we need to fix
getting all the members of an object by using the wildcard notation.
|
|
|
|
|
|
|
|
|
| |
Using the same data as in tests, asking for $['store']['book'][*] JSON path
should return all the book objects in an array.
But that array is returned inside another array, dupped several times.
https://bugzilla.gnome.org/show_bug.cgi?id=691557
|
|
|
|
|
|
|
|
| |
Starting from GLib 2.36, g_type_init() is going to be deprecated (the
type system will be initialized as soon as libgobject is paged in, using
constructors). As I don't want to bump dependencies just for that, the
call to g_type_init() should be placed under a compile-time version
check, to keep the noise from compiler warnings down.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
This is the positive equivalent of the test case inside the invalid test
unit.
|
| |
|
| |
|
| |
|