diff options
author | bi <bisnard@antidot.net> | 2013-05-16 14:00:03 +0200 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2013-12-02 11:29:48 +0000 |
commit | 35562f291b7bf1bae88d7e5f78d7be163ca263d6 (patch) | |
tree | e245efd76e42bb81afbff7743aa78c6d3376c6ea /json-glib | |
parent | d82420c14b19f29a993b7754ff1128b3524c4ad7 (diff) | |
download | json-glib-35562f291b7bf1bae88d7e5f78d7be163ca263d6.tar.gz |
Add tests for json paths (2 invalids, 1 valid)
Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
Conflicts:
json-glib/tests/path.c
Diffstat (limited to 'json-glib')
-rw-r--r-- | json-glib/tests/path.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/json-glib/tests/path.c b/json-glib/tests/path.c index 23268d5..0dce631 100644 --- a/json-glib/tests/path.c +++ b/json-glib/tests/path.c @@ -45,6 +45,13 @@ static const struct { JsonPathError error_code; } test_expressions[] = { { + "INVALID: invalid first character", + "/", + NULL, + FALSE, + JSON_PATH_ERROR_INVALID_QUERY, + }, + { "INVALID: Invalid character following root", "$ponies", NULL, @@ -52,6 +59,13 @@ static const struct { JSON_PATH_ERROR_INVALID_QUERY, }, { + "INVALID: missing member name or wildcard after dot", + "$.store.", + NULL, + FALSE, + JSON_PATH_ERROR_INVALID_QUERY, + }, + { "INVALID: Malformed slice (missing step)", "$.store.book[0:1:]", NULL, @@ -151,6 +165,16 @@ static const struct { "[\"red\",\"19.95\"]", TRUE, }, + { + "The root node.", + "$", + "[{\"store\":{\"book\":[{\"category\":\"reference\",\"author\":\"Nigel Rees\",\"title\":\"Sayings of the Century\",\"price\":\"8.95\"}," + "{\"category\":\"fiction\",\"author\":\"Evelyn Waugh\",\"title\":\"Sword of Honour\",\"price\":\"12.99\"}," + "{\"category\":\"fiction\",\"author\":\"Herman Melville\",\"title\":\"Moby Dick\",\"isbn\":\"0-553-21311-3\",\"price\":\"8.99\"}," + "{\"category\":\"fiction\",\"author\":\"J. R. R. Tolkien\",\"title\":\"The Lord of the Rings\",\"isbn\":\"0-395-19395-8\",\"price\":\"22.99\"}]," + "\"bicycle\":{\"color\":\"red\",\"price\":\"19.95\"}}}]", + TRUE, + } }; static void |