diff options
Diffstat (limited to 'test/suites/api/test_simple.c')
-rw-r--r-- | test/suites/api/test_simple.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/suites/api/test_simple.c b/test/suites/api/test_simple.c index 8b56954..e461561 100644 --- a/test/suites/api/test_simple.c +++ b/test/suites/api/test_simple.c @@ -224,4 +224,17 @@ static void run_tests() json_incref(value); if(value->refcount != (size_t)-1) fail("refcounting null works incorrectly"); + +#ifdef json_auto_t + value = json_string("foo"); + { + json_auto_t *test = json_incref(value); + /* Use test so GCC doesn't complain it is unused. */ + if(!json_is_string(test)) + fail("value type check failed"); + } + if(value->refcount != 1) + fail("automatic decrement failed"); + json_decref(value); +#endif } |