diff options
author | Petri Lehtinen <petri@digip.org> | 2009-07-09 21:01:40 +0300 |
---|---|---|
committer | Petri Lehtinen <petri@digip.org> | 2009-07-09 21:01:40 +0300 |
commit | 8ef778c8431c17d970b2667943c6ea13c3770912 (patch) | |
tree | 679218a200a1e722629c8c539716fd370ff8e1b5 /test/loadf_dumpf.c | |
parent | 6b14df13cc1b453d0cc277d0ba50cbabc2745089 (diff) | |
download | jansson-8ef778c8431c17d970b2667943c6ea13c3770912.zip jansson-8ef778c8431c17d970b2667943c6ea13c3770912.tar.gz jansson-8ef778c8431c17d970b2667943c6ea13c3770912.tar.bz2 |
Add some tests
Diffstat (limited to 'test/loadf_dumpf.c')
-rw-r--r-- | test/loadf_dumpf.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/loadf_dumpf.c b/test/loadf_dumpf.c new file mode 100644 index 0000000..5d42156 --- /dev/null +++ b/test/loadf_dumpf.c @@ -0,0 +1,24 @@ +#include <stdio.h> +#include <jansson.h> + +int main(int argc, char *argv[]) +{ + json_t *json; + json_error_t error; + + if(argc != 1) { + fprintf(stderr, "usage: %s\n", argv[0]); + return 2; + } + + json = json_loadf(stdin, &error); + if(!json) { + fprintf(stderr, "%d\n%s\n", error.line, error.text); + return 1; + } + + json_dumpf(json, stdout, 0); + json_decref(json); + + return 0; +} |