summaryrefslogtreecommitdiff
path: root/json-glib/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* tests/serialize-complex: Modify the instanceEmmanuele Bassi2011-06-011-11/+11
| | | | | Do not test the defaults: create the GObject instance with different values than the default ones from the GParamSpec.
* Add initial JSONPath implementationEmmanuele Bassi2011-05-312-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | JSONPath is a JSON query syntax similar to what XPath does for XML; using JSONPath it's possible to address a specific node (or set of nodes) inside a JSON document. The JsonPath class is a simple implementation of part of the JSONPath proposal, as formalised by Stefan Gössner here: http://goessner.net/articles/JsonPath/ The covered operators are: • root, or '$'; • child, both using the dot-notation and the bracket notation; • recursive descent, or '..'; • subscript, or '[]'; • set, or '[,]'; • slice, or '[start:end:step]'. The only missing operators are the filter, or '?()' and the script, or '()', because implementing a JavaScript interpreter inside JSON-GLib is not one of my greatest aspirations. It should be possible, though, to parse and evaluate simple arithmetic conditions, in the future. The JsonPath methods are pretty straightforward: a JsonPath instance should be created and used to compile an expression; the compilation might result in a syntax error or not. Then, the JsonPath instance can be used to match any JSON tree. Like the other JSONPath implementations, JsonPath returns a JSON array of matching nodes. A simple, one-off static method called json_path_query() is also provided; the method wraps the JsonPath creation, the expression compilation, and the matching, as well as disposing the JsonPath instance once done. For the time being, only positive testing is provided; negative testing for the expression compilation will follow.
* tests: Fix up the JsonBuilder testEmmanuele Bassi2011-05-281-6/+46
| | | | | Clean up some odd code, and add a unit for the empty object case outlined in bug 651271.
* tests: Move all tests under json-glibEmmanuele Bassi2011-05-285-36/+1142
| | | | | The test framework should live under the json-glib directory, and not be spread across the project.
* generator: Removes blank spaces from generated JSON when not pretty-printEduardo Lima Mitev2011-03-113-59/+59
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=640729
* tests/object: Add a set_member() unitEmmanuele Bassi2011-02-151-0/+29
| | | | | Verify that setting an object member multiple times does not lead to random values.
* reader: Add accessor for the member nameEmmanuele Bassi2011-02-061-0/+1
| | | | This should allow easy access to the member name during iteration.
* reader: Allow using read_element() on objectsEmmanuele Bassi2011-02-061-0/+6
| | | | | | | | | | | | | | | If we assume that a JSON object is just an array with a named mapping then the JsonReader API should be able to descend into objects using the same API used for arrays. This obviously is less useful than it sounds if we take a very strict interpretation of JSON objects as unordered string-to-value mappings; as the ordering is not guaranteed to be stable, parsers would be fairly weak against various JSON definitions. If the JSON format parsed is guaranteed to be stable then an integer offset might be an easy (albeit slightly less performant) way to access data.
* reader: Add list_members() methodEmmanuele Bassi2011-02-041-0/+19
| | | | | Allow retrieving a list of member names from the current cursor position of the JsonReader. It's useful if you're trying to inspect a JSON tree.
* gvariant: Adds JSON GVariant integration API, with docs and testsEduardo Lima Mitev2011-01-262-0/+237
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=632940
* builder-test: Do not compare serialized double valuesEmmanuele Bassi2011-01-101-2/+2
| | | | | Serialization of floating point values might lead to odd formats, especially when dealing with IEEE machine-neutral values.
* generator: Verify that the decimal separator is locale-independentEmmanuele Bassi2010-12-141-0/+58
| | | | | | There shouldn't be a requirement for this, since we're using the GLib function explicitely for this reason, but it's always good to have a comprehensive test suite.
* build: Automate ignoring test binariesEmmanuele Bassi2010-08-141-0/+4
| | | | | Use noinst_PROGRAMS to generate the list of test binaries to ignore directly in the test directories.
* reader: Add :root constructor propertyEmmanuele Bassi2010-08-141-2/+2
| | | | | A JsonReader is useless without a root JsonNode to start walking the tree from.
* reader: Do not wrap JsonParserEmmanuele Bassi2010-08-121-2/+9
| | | | | | | Since JsonParser has far more methods for parsing a JSON stream we should just make JsonReader an API for reading an already parsed JSON tree - in the same way that JsonBuilder does not generate the stringified version of the JSON tree it builds.
* reader: Mirror the JsonBuilder API value accessorsEmmanuele Bassi2010-08-121-4/+4
| | | | We should strive to make JsonBuilder and JsonReader similar in API.
* Add JsonReaderEmmanuele Bassi2010-08-122-3/+108
| | | | | | JsonReader is a simple, cursor-based API for parsing a JSON DOM. It is similar, in spirit, to the XmlReader API provided by various platforms and XML parsing libraries.
* json-glib/tests: explicitely link against glibDiego Escalante Urrelo2010-08-111-1/+2
| | | | | | Tests fail to link otherwise. Bug #626669
* build: Fix up the tests data pathEmmanuele Bassi2010-08-022-3/+3
| | | | | | Since we load up a test file from a directory, we should be using a path - otherwise this will break out-of-tree builds, e.g. when doing a distcheck.
* Exercise the stream API in JsonParserEmmanuele Bassi2010-08-023-0/+81
|
* builder: Add convenience API for building JSON trees.Luca Bruno2010-06-162-0/+124
| | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=621141 Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>