summaryrefslogtreecommitdiff
path: root/json-glib/tests/object-test.c
Commit message (Collapse)AuthorAgeFilesLines
* build: Rename test binariesEmmanuele Bassi2011-06-191-165/+0
| | | | It's pointless to add the '-test' suffix to files under the tests/ directory.
* 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.
* Allow NULL as a value for strings, arrays and objectsEmmanuele Bassi2010-06-161-0/+4
| | | | | We should not warn when asking for a string, array or object if the contents were 'null'.
* [tests] Add a test case for Object members with empty stringsEmmanuele Bassi2009-09-281-0/+13
| | | | | | | 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.
* [tests] Include json-glib.hEmmanuele Bassi2009-08-121-1/+1
| | | | Do not include json-types.h, use the correct global include.
* Auto-promote integer types to G_TYPE_INT64Emmanuele Bassi2009-08-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add JsonObject iteration functionEmmanuele Bassi2009-05-161-0/+57
| | | | | The json_object_foreach_member() function iterates over a JsonObject data type.
* Update after the json_object_add_member() deprecationEmmanuele Bassi2009-04-171-2/+2
| | | | | | | 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.
* Add JsonObject test unitEmmanuele Bassi2008-03-051-0/+62
Use a similar test unit as the JsonArray one, testing creation, empty objects, addition and removal of members.