| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Complete the porting of the old test suite into the new, GTest based one.
The new test suite is automatically run with make test; make test-report
will generate an XML report of the test.
The API coverage for the data types is part of the json-glib/tests
directory and will be expanded later.
|
|
|
|
| |
The test-08 case was the last numbered test unit.
|
|
|
|
|
|
| |
The new test-serialize-complex adds a test unit for the JsonSerializable
interface; the TestObject implements the serialization interface to
create a JSON data type from a boxed GType.
|
|
|
|
|
| |
The new test-serialize-simple tests the GObject integration for
serializing simple GObjects into JSON.
|
| |
|
|
|
|
|
| |
First pass into replacing the last three numbered tests into named
tests.
|
|
|
|
|
|
|
|
|
|
| |
Like we did for JsonParser, JsonGenerator has now a test unit checking the
output of a DOM built and dumped into a buffer.
For the arrays is quite easy to verify that the output is correct;
unfortunately, JsonObject does not guarantee any ordering on the members,
with it being an associative array. Hence, for the object test case we
just compare the length of the output.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Like for the simple arrays test case, add validation of the values types
for the members of the simple objects test case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instead of just checking that the array contains something, the simple-array
test case should validate the contents of the array.
The test now uses a struct defining:
- the test array
- the size of the array
- an element to check
- the type of the node for the element
- the type of the value for the node
All the fields are checked for a match. This makes the simple arrays test
case more reliable.
|
|
|
|
|
| |
This simple unit will test the JsonArray API, as part of the coverage
test for the JSON-GLib types.
|
|
|
|
|
|
|
| |
The third test under the tests/ directory was the last JsonParser test,
dealing with object parsing. Now, test-parser is complete and contains
all the JsonParser test cases. It still needs further testing to
verify the DOM created by the parser object.
|
|
|
|
|
|
|
|
|
| |
Instead of having stand alone tests, use the GTest framework and start
coalescing multiple test cases into one.
The tests directory will be used for JsonParser, JsonGenerator and
the JSON-GObject integration API, by reusing the previous test cases
and remolding them into a more interesting test framework.
|
| |
|
|
|
|
|
|
|
| |
Instead of using a single test for empty strings and another test for
arrays, merge the two into a single test unit, using the GTest API.
The JsonObject parsing test will also be merged later.
|
|
|
|
|
|
|
|
|
| |
The old test-01 program tested the JsonParser with an empty string; instead
of relying on the exit code and error messages on screen, it shoul use the
new GTest API.
This is the first test of the old test suite to be ported to the new test
framework API.
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a dependencies file, so that valac can simply use the json-glib-1.0
package and correcly chain up all the dependencies needed (at the moment,
only glib-2.0).
Update the vapi file to match with the GLib bindings with regards to the
out length parameters and some weak pointers. The only way to properly
solve the weak assignments issue would be to make JsonNode, JsonObject
and JsonArray proper GObjects, or at least add reference counting to
JsonNode. Not going to happend in 0.6, but it's worth adding it to the
1.0 roadmap.
|
|
|
|
|
| |
Rules starting with '%' are a make-isms, and automake 1.10 complains a
lot about them.
|
|
|
|
|
| |
The json_parser_peek_root() function has been removed, and so we do not
its symbol in the json-glib-sections.txt file anymore.
|
|
|
|
|
| |
Do not free the root node returned by the get_root() method in the
JSON-GObject API and in the JsonParser tests.
|
|
|
|
|
|
|
|
|
| |
The get_root() method should not return a copy of the parsed node: it is
up to the developer copying it, if it needs to be kept around across multiple
parsing runs.
This commit reverts the 0b6b09c0 commit, by removing the peek_root() method
and restoring the previous get_root() method behaviour.
|
|
|
|
|
| |
The json_object_has_member() used the passed in member name, instead of
the correctly normalized one.
|
|
|
|
|
|
|
|
| |
The JsonParser object clears its state upon starting the parsing sequence
or during the instance destruction process. It's worth moving the free
and unref calls into their own function to be called by the load_from_data()
and dispose methods. As further optimisation, inlining them should be
worth as well.
|
|
|
|
|
| |
Including the autotools generated config.h should always be conditional
on the HAVE_CONFIG_H definitions.
|
|
|
|
| |
Use an intermediary pointer to avoid a lot of pointer dereferences
|
|
|
|
|
|
|
|
| |
Expose the properties as members and remove the accessor methods in case
it's obvious that they are just function proxies.
Also, start binding the basic GObject API, even though no serializable
support is ready, yet.
|
|
|
|
|
|
|
|
| |
The JsonSerializable interface can provide a default implementation, using
the powers of GTypeInterface. This means that classes implementing the
interface can opt to implement both, either or none of the JsonSerializable
methods, and still be able to retain some basic functionality for the methods
they decide not to implement.
|
|
|
|
|
|
| |
When the same JsonParser loads a different buffer it needs to clear out the
current state; this means clearing the variable_name string it saves when
the passed JSON stream is a JavaScript assignment.
|
|
|
|
|
|
|
| |
Since we allow a negative value, meaning "take the whole string", for the
length parameter, when need a signed size_t. This also fixes the bug where
we implicitly always computed the buffer length and discarded the passed
length parameter.
|
|
|
|
| |
Avoid feeding garbage to the callers by using g_slice_new0().
|
|
|
|
| |
Found this very dumb leak while using Valgrind.
|
|
|
|
|
|
| |
The pointer returned by g_value_get_boxed() is just a pointer to the internal
copy inside GValue, and it's not ours to free, as Valgrind gently pointed
out.
|
|
|
|
|
|
| |
We don't provide the Serializable interface at the moment, because it
is too much C-oriented. This example shows how to serialize a class in
Vala to a JSON string.
|
| |
|
|
|
|
|
|
|
|
|
| |
Miscellaneous fixes for the Vala bindings of JSON-GLib:
* add missing return values for a couple of methods
* decorate the Object and Array constructors with their C names
* correctly transfer the ownership when adding members/elements
* add the non-null value marker for strings
* provide default values for the length argument in from_data()/to_data()
|
|
|
|
|
|
| |
If Vala is not available then there's no point in getting into the
contrib directory. This might change in the future, so we already
have the HAVE_VALA conditional for the Makefiles.
|
| |
|