| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
We should not warn when asking for a string, array or object if the
contents were 'null'.
|
|
|
|
|
|
| |
We identify a missing ':' separator between an object member name and
its value, so it would be a good thing to actually have an error code
for that.
|
|
|
|
|
|
|
|
|
| |
The JsonScanner error reporting mechanism, which is basically
GScanner's, sucks beyond belief. In order to report an error code we
need to store it inside the JsonParser private structure and then use it
when creating the GError inside the error handler.
This, frankly, is quite stupid.
|
| |
|
|
|
|
|
| |
The nested object test should use something that's really complex: an
object with a nested array and nested object definitions.
|
| |
|
|
|
|
| |
Verify that invalid JSON will trigger a parser error.
|
|
|
|
|
| |
The tests should be compiled under the same flags as the rest of the
library.
|
|
|
|
| |
Use typed accessors instead of using GValues all around.
|
|
|
|
|
| |
While verifying Array.foreach() we should also verify that the list we
are iterating on is the same returned by the get_elements() method.
|
|
|
|
|
|
| |
Use the JSON object example inside the RFC 4627 to verify that the
JsonGenerator creates the right output. This is now possible as we
garantee the order of a JsonObject members.
|
|
|
|
|
|
|
|
|
|
| |
Use the json-glib/tests directory for testing the data structures of
JSON-GLib: node, object, array, parser and generator.
The tests/ directory should be used for complex test cases, like the
GObject and GBoxed integration - but the goal is to remove the top-level
tests/ directory altogether, since the conformance test suite should be
built along the json-glib/ directory.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some of the rules can be moved into their own files to be included
when needed, like:
• silent rules (QUIET_*)
• glib-mkenums rules
• glib-genmarshal rules
Also, the test suite rules should be moved from the top-level of
the project into the build/autotools directory and then included
only where it makes sense.
This requires changing most of the build system to use the new
files layout.
|
|
|
|
| |
JsonNode should mimick GValue's API and have macros for easy type checking
|
|
|
|
|
|
|
| |
Both the Object API and the Parser should not choke on members with
empty strings as their value. The Object should just have a member
associated with a JSON_NODE_VALUE node type and an empty string as
the contents.
|
|
|
|
| |
Do not include json-types.h, use the correct global include.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The JSON RFC does not specify the size of the integer type, thus
implicitly falling back to machine-size.
This would all be fine and dandy if some demented Web Developer (and
I use the term "developer" *very much* loosely) did not decide to
use integers to store unique identifiers for objects; obviously, you
can't have more than 2^32-1 status messages in a database with
millions of users who update their status multiple times per day.
Right, Twitter?
Anyway, some languages do a type auto-promotion from Integer to
Long, thus pushing the limit of allowed positive values -- until the
next integer overflow, that is. C, and GLib, do not do that
transparently for us so we need to:
- always use gint64 when parsing a JSON data stream using
JsonScanner
- move all the Node, Object and Array APIs to gint64
- auto-promote G_TYPE_INT to G_TYPE_INT64 when setting
a GValue manually
- auto-promote and auto-demote G_TYPE_INT properties when
(de)serializing GObjects.
The GLib types used internally by JSON-GLib are, thus:
integer -> G_TYPE_INT64
boolean -> G_TYPE_BOOLEAN
float -> G_TYPE_DOUBLE
string -> G_TYPE_STRING
|
|
|
|
|
|
|
|
|
|
| |
The JsonNode structure has always been meant to be completely
opaque; we indirectly exposed the :type member, but only for
access through the JSON_NODE_TYPE() macro.
Since that macro has become a proxy for the json_node_get_node_type()
function we can safely move everything into a private, uninstalled
header file and let JsonNode be completely opaque to the developer.
|
|
|
|
|
|
| |
Similarly to commit 3057a172 for JsonObject, the newly added
json_array_foreach_element() iterates over a JSON array data
type.
|
|
|
|
|
| |
The json_object_foreach_member() function iterates over a JsonObject
data type.
|
|
|
|
|
|
|
| |
Since json_object_add_member() has been deprecated and it's using
a gcc compiler attribute to loudly complain while compiling the
library, we should restore the sanity and use json_object_set_member()
instead.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Bug 1353 - Copying JSON_NODE_VALUE nodes unreliable at best
When copying a JsonNode to another we do an implicit memcpy using:
*copy = *src
Which works well enough with pointers, but makes a mess out of the
value-based nodes.
We should just copy the type of the original JsonNode and leave the
rest to the switch() block.
In order to catch potential regressions, we also need a more
thorough test unit for the JsonNode copy operation.
|
|
|
|
| |
Test the GValue API for storing fundamental types into a JsonNode.
|
|
|
|
|
| |
Use a similar test unit as the JsonArray one, testing creation, empty
objects, addition and removal of members.
|
|
|
|
|
|
| |
Remove the json_array_remove_element() call from the add-element test unit
and set up a separate test case for the element removal. This keeps the
test cases clean.
|
|
|
|
|
| |
This simple unit will test the JsonArray API, as part of the coverage
test for the JSON-GLib types.
|
|
|
|
|
| |
The test unit copies a NULL JsonNode and checks that the copy and the
original nodes are equivalent.
|
|
GLib 2.15 added a new test unit framework to the GLib API. It allows
integrating unit testing into GLib and GObject based libraries and
applications.
It requires a specially crafter Makefile holding a set of declarations,
which must be included into the project own Makefile templates; then
it is possible to drop tests inside a subdirectory, which will be built
after the library or application, and executed upon "make check".
At the moment, there is a simple test for the JsonNode API, with a
single unit for the "null" node type.
|