diff options
| author | dota17 <chenguopingdota@163.com> | 2020-01-20 15:00:11 +0800 |
|---|---|---|
| committer | dota17 <chenguopingdota@163.com> | 2020-01-20 16:46:46 +0800 |
| commit | 010f33d4601fbafa099cebaf7cbcfba715496b3f (patch) | |
| tree | 0083e009f7a96493d06eff1714aea03979fc52b8 /tests | |
| parent | 360d28b9611a4ee9f4312e1e76e0b5c8d674ec14 (diff) | |
| download | json-c-010f33d4601fbafa099cebaf7cbcfba715496b3f.tar.gz | |
add json_object_new_null
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test1.c | 6 | ||||
| -rw-r--r-- | tests/test1.expected | 1 | ||||
| -rw-r--r-- | tests/test1Formatted_plain.expected | 1 | ||||
| -rw-r--r-- | tests/test1Formatted_pretty.expected | 1 | ||||
| -rw-r--r-- | tests/test1Formatted_spaced.expected | 1 | ||||
| -rw-r--r-- | tests/test1Formatted_spaced_pretty.expected | 1 | ||||
| -rw-r--r-- | tests/test1Formatted_spaced_pretty_pretty_tab.expected | 1 |
7 files changed, 11 insertions, 1 deletions
diff --git a/tests/test1.c b/tests/test1.c index 3ddaf72..ce1418b 100644 --- a/tests/test1.c +++ b/tests/test1.c @@ -137,7 +137,7 @@ void test_array_del_idx() int main(int argc, char **argv) { - json_object *my_string, *my_int, *my_object, *my_array; + json_object *my_string, *my_int, *my_null, *my_object, *my_array; size_t i; #ifdef TEST_FORMATTED int sflags = 0; @@ -179,6 +179,9 @@ int main(int argc, char **argv) printf("my_int=%d\n", json_object_get_int(my_int)); printf("my_int.to_string()=%s\n", json_object_to_json_string(my_int)); + my_null = json_object_new_null(); + printf("my_null.to_string()=%s\n", json_object_to_json_string(my_null)); + my_array = json_object_new_array(); json_object_array_add(my_array, json_object_new_int(1)); json_object_array_add(my_array, json_object_new_int(2)); @@ -249,6 +252,7 @@ int main(int argc, char **argv) json_object_put(my_string); json_object_put(my_int); + json_object_put(my_null); json_object_put(my_object); json_object_put(my_array); diff --git a/tests/test1.expected b/tests/test1.expected index e36d372..4cafba6 100644 --- a/tests/test1.expected +++ b/tests/test1.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 diff --git a/tests/test1Formatted_plain.expected b/tests/test1Formatted_plain.expected index 8a05723..6cbf356 100644 --- a/tests/test1Formatted_plain.expected +++ b/tests/test1Formatted_plain.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 diff --git a/tests/test1Formatted_pretty.expected b/tests/test1Formatted_pretty.expected index 809dfbe..766b04f 100644 --- a/tests/test1Formatted_pretty.expected +++ b/tests/test1Formatted_pretty.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 diff --git a/tests/test1Formatted_spaced.expected b/tests/test1Formatted_spaced.expected index 6afb39f..7ac0fb2 100644 --- a/tests/test1Formatted_spaced.expected +++ b/tests/test1Formatted_spaced.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 diff --git a/tests/test1Formatted_spaced_pretty.expected b/tests/test1Formatted_spaced_pretty.expected index 376da12..0b1f220 100644 --- a/tests/test1Formatted_spaced_pretty.expected +++ b/tests/test1Formatted_spaced_pretty.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 diff --git a/tests/test1Formatted_spaced_pretty_pretty_tab.expected b/tests/test1Formatted_spaced_pretty_pretty_tab.expected index d237669..5434544 100644 --- a/tests/test1Formatted_spaced_pretty_pretty_tab.expected +++ b/tests/test1Formatted_spaced_pretty_pretty_tab.expected @@ -12,6 +12,7 @@ my_string=foo my_string.to_string()="foo" my_int=9 my_int.to_string()=9 +my_null.to_string()=null my_array= [0]=1 [1]=2 |
