]> git.ipfire.org Git - thirdparty/json-c.git/commitdiff
Issue #300: Use %p instead of %lx in test_util_file since some platforms' pointers...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Sun, 5 Feb 2017 04:37:27 +0000 (04:37 +0000)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Sun, 5 Feb 2017 04:38:53 +0000 (04:38 +0000)
Also, there's no need to worry about output consistency here, since it'll be
 different anyway due to different pointer values.

tests/test_util_file.c
tests/test_util_file.expected

index 950233b69b367606af8dd84e616654dfe7061547..1b4b066d89af79ba3468309743b85a6a6f2e167c 100644 (file)
@@ -147,8 +147,8 @@ static void test_read_nonexistant()
        json_object *jso = json_object_from_file(filename);
        if (jso != NULL)
        {
-               printf("FAIL: json_object_from_file(%s) returned 0x%lx when NULL expected\n",
-                      filename, (unsigned long)jso);
+               printf("FAIL: json_object_from_file(%s) returned %p when NULL expected\n",
+                      filename, (void *)jso);
                json_object_put(jso);
        }
        else
@@ -178,14 +178,14 @@ static void test_read_closed()
        json_object *jso = json_object_from_fd(fixed_d);
        if (jso != NULL)
        {
-               printf("FAIL: read from closed fd returning non-NULL: 0x%lx\n",
-                      (unsigned long) jso);
+               printf("FAIL: read from closed fd returning non-NULL: %p\n",
+                      (void *)jso);
                fflush(stdout);
                printf("  jso=%s\n", json_object_to_json_string(jso));
                json_object_put(jso);
                return;
        }
        printf("OK: json_object_from_fd(closed_fd), "
-              "expecting NULL, EBADF, got:0x%lx, %s\n",
-              (unsigned long)jso, json_util_get_last_err());
+              "expecting NULL, EBADF, got:NULL, %s\n",
+              json_util_get_last_err());
 }
index c37f10fa32cbe481599342b1e840a929227d0ada..09121b9959ae30bb6bb6ed423427d9d40276a062 100644 (file)
@@ -1,7 +1,7 @@
 OK: json_object_from_fd(./valid.json)={ "foo": 123 }
 OK: json_object_from_file(./not_present.json) correctly returned NULL: json_object_from_file: error opening file ./not_present.json: ERRNO=ENOENT
 
-OK: json_object_from_fd(closed_fd), expecting NULL, EBADF, got:0x0, json_object_from_fd: error reading fd 10: ERRNO=EBADF
+OK: json_object_from_fd(closed_fd), expecting NULL, EBADF, got:NULL, json_object_from_fd: error reading fd 10: ERRNO=EBADF
 
 OK: json_object_to_file(json.out, jso)=0
 file[json.out], size=336, contents={"foo":1234,"foo1":"abcdefghijklmnopqrstuvwxyz","foo2":"abcdefghijklmnopqrstuvwxyz","foo3":"abcdefghijklmnopqrstuvwxyz","foo4":"abcdefghijklmnopqrstuvwxyz","foo5":"abcdefghijklmnopqrstuvwxyz","foo6":"abcdefghijklmnopqrstuvwxyz","foo7":"abcdefghijklmnopqrstuvwxyz","foo8":"abcdefghijklmnopqrstuvwxyz","foo9":"abcdefghijklmnopqrstuvwxyz"}