summaryrefslogtreecommitdiff
path: root/json-glib/tests
Commit message (Collapse)AuthorAgeFilesLines
* build: Don't copy test data in the build directoryjson-glib-1-2Emmanuele Bassi2017-04-011-9/+6
| | | | | | | | | 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. (cherry picked from commit 9642e81c73093e4dde11f8c047a41771b884e3d7) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* build: Use the Meson 'python3' moduleEmmanuele Bassi2017-04-011-1/+1
| | | | | | | | | This allows finding Python3 on Windows, in order to build and run the tests. https://bugzilla.gnome.org/show_bug.cgi?id=780550 (cherry picked from commit 59762fabeae64f9b80993729ef38df730686a3f8) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
* build: Fix the installed test wrapper fileEmmanuele Bassi2017-03-291-1/+1
| | | | | We need to point to the binary, but we're using the wrong name for the Exec key.
* Install testsEmmanuele Bassi2017-03-132-1/+41
| | | | | | We should install our tests in order to get them executed in environments like GNOME Continuous and other continuous delivery systems.
* Update the Meson buildEmmanuele Bassi2017-03-131-11/+14
| | | | | | Clean up the coding style, and make it a bit more idiomatic. https://bugzilla.gnome.org/show_bug.cgi?id=773603
* meson: Add support for building with the meson build systemThibault Saunier2017-03-131-0/+34
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=773603
* Don't loose decimal in whole-double -> string conversiondjcb2017-03-132-2/+24
| | | | | | | | | | | | | 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
* Allow empty string as object member nameDr. David Alan Gilbert2017-03-115-5/+16
| | | | | | | | | | | 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
* core: Add immutability support to core objectsPhilip Withnall2016-03-011-0/+320
| | | | | | | | | | | 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
* parser: Detect missing commas in arraysEmmanuele Bassi2016-02-251-0/+31
| | | | | Just like we detect trailing commas, we should also detect missing ones to avoid parsing invalid JSON successfully.
* object: Add JsonObjectIter to ease iteration over JsonObject membersPhilip Withnall2015-10-061-0/+28
| | | | | | | | | | 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
* tests/builder: Don't duplicate test namesIain Lane2015-10-021-1/+1
| | | | | | GLib 2.46.0 forbids this and so the testsuite fails. https://bugzilla.gnome.org/show_bug.cgi?id=755977
* json-gvariant: Parse json doubles that are whole numbersStef Walter2015-01-261-0/+4
| | | | | | | | | 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
* reader: Maintain a stack of member namesPhilip Withnall2015-01-251-0/+13
| | | | | | | | | | | | | | | | | | | | | 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
* generator: Add tests for updated string escaping routineStef Walter2014-05-211-0/+47
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=730425
* tests: Add more checks to the parser stream unitEmmanuele Bassi2014-04-171-6/+16
|
* build: Include $(top_builddir)Emmanuele Bassi2014-03-181-0/+2
| | | | Fixes compilation in cases where builddir != srcdir.
* Remove conditional inclusion of config.hEmmanuele Bassi2014-03-183-6/+0
| | | | All the platforms and build system we support have a config.h header.
* tests: Add new test for reader level bugBastien Nocera2014-02-031-0/+43
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=723428
* tests/gvariant: Use G_N_ELEMENTSEmmanuele Bassi2013-12-021-5/+5
| | | | Instead of sizeof(array)/sizeof(type).
* Make JSON to GVariant conversion handle some string to number conversions.Joseph Artsimovich2013-12-021-7/+30
| | | | | | | | | 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
* Add tests for json paths (2 invalids, 1 valid)bi2013-12-021-0/+24
| | | | | | | Signed-off-by: Emmanuele Bassi <ebassi@gnome.org> Conflicts: json-glib/tests/path.c
* parser: Fix all occurances of TESTS_DATA_DIREmmanuele Bassi2013-08-221-6/+1
| | | | And use g_test_build_filename().
* parser: Use the proper GLib API to find test data filesEmmanuele Bassi2013-08-222-7/+1
| | | | | | | Instead of our homegrown solution. This should fix the regression in the installed tests case. Original patch by: Colin Walters <walters@verbum.org>
* Remove compile time GLib version checkEmmanuele Bassi2013-08-2114-43/+0
| | | | | We depend on a new version of GLib, so we can remove a bunch of old version checks.
* tests: Use the new TAP support in GTestEmmanuele Bassi2013-08-211-44/+8
| | | | | Instead of using the old GLib test harness, we should use the newly added TAP support and the TAP driver inside autotools.
* build: Add --enable-installed-testsEmmanuele Bassi2013-05-162-11/+59
| | | | | | | See https://live.gnome.org/GnomeGoals/InstalledTests for more information. It's still possible to run `make check` with locally uninstalled tests.
* tests: Improve the JsonPath suiteEmmanuele Bassi2013-05-161-61/+121
| | | | | Run each expression as a separate unit, so we can catch errors more quickly and easily.
* tests/path: Start adding negative tests for JsonPathEmmanuele Bassi2013-05-151-0/+14
|
* tests/path: Allow testing for valid queriesEmmanuele Bassi2013-05-151-14/+50
| | | | | | | 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.
* path: Fix get all object members with wildcardEmmanuele Bassi2013-01-111-5/+23
| | | | | 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.
* path: Fix get all array elements with wildcardJuan A. Suarez Romero2013-01-111-0/+4
| | | | | | | | | 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
* tests: Put g_type_init() under conditional compilationEmmanuele Bassi2012-10-2714-0/+29
| | | | | | | | 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.
* tests/reader: Improve test coverageEmmanuele Bassi2012-10-271-5/+19
|
* tests: Improve coverageEmmanuele Bassi2012-10-261-52/+104
|
* tests: Improve coverageEmmanuele Bassi2012-10-263-2/+80
|
* tests: Improve coverageEmmanuele Bassi2012-10-262-0/+43
|
* tests/parser: Check negative numeric valuesEmmanuele Bassi2012-10-261-1/+15
| | | | | This is the positive equivalent of the test case inside the invalid test unit.
* tests/invalid: Improve test coverageEmmanuele Bassi2012-10-261-0/+32
|
* tests/invalid: Add more invalid JSON testsEmmanuele Bassi2012-10-251-17/+96
|
* tests/invalid: Check invalid assignmentsEmmanuele Bassi2012-10-251-4/+40
|
* tests: Move the invalid JSON unit to its own fileEmmanuele Bassi2012-10-253-52/+94
| | | | Instead of putting it inside the parser unit test.
* node: Implicitly convert numeric typesEmmanuele Bassi2012-07-151-0/+35
| | | | | | | | When retrieving an int, a double, or a boolean, we can use the C rules of implicit conversion to move from the actual stored type inside the JsonValue to the requested C type. https://bugzilla.gnome.org/show_bug.cgi?id=660795
* Improve test coverageEmmanuele Bassi2012-06-302-0/+20
|
* tests: Add more coverage to JsonNodeEmmanuele Bassi2012-06-301-6/+107
|
* Adapt to the demise of single includes in GLibMatthias Clasen2011-10-122-2/+2
|
* gobject: Deserialize CONSTRUCT propertiesEmmanuele Bassi2011-08-232-2/+20
| | | | | | | | | | | | While we have to give up deserializing CONSTRUCT_ONLY properties with JsonSerializable, CONSTRUCT properties should just be deserialized like any other property. Sadly, there's still a refuse in the json_gobject_new() code that skips CONSTRUCT properties along with CONSTRUCT_ONLY ones — a remnant of a period when we deserialized them both without JsonSerializable. https://bugzilla.gnome.org/show_bug.cgi?id=655526
* tests/path: Link expressions and resultsEmmanuele Bassi2011-07-051-27/+47
| | | | | Use a structure to keep the testable expressions and their results together.
* Link the tests against the appropriate libraries.Travis Reitter2011-06-241-1/+4
| | | | | | This avoids some linking failures. Closes: bgo#653295 - json-glib tests need to link against libgobject-2
* build: Rename test binariesEmmanuele Bassi2011-06-1910-9/+9
| | | | It's pointless to add the '-test' suffix to files under the tests/ directory.