]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-format-table: add test for unsetting table name 35451/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Dec 2024 09:36:09 +0000 (10:36 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 3 Dec 2024 14:00:26 +0000 (15:00 +0100)
This should extend coverage to another part that previously wasn't covered.

src/test/test-format-table.c

index 1660b83c31de49cacfef5aa14938c7acf7a2dc96..3bfbf1fc467c872e0c7810db05efd246bd1ce8d5 100644 (file)
@@ -372,6 +372,8 @@ TEST(json) {
                                  TABLE_HEADER, "piep miau",
                                  TABLE_HEADER, "asdf",
                                  TABLE_SET_JSON_FIELD_NAME, "asdf-custom"));
+        ASSERT_OK(table_set_json_field_name(t, 2, "ZZZ"));
+        ASSERT_OK(table_set_json_field_name(t, 2, NULL));
         ASSERT_OK(table_set_json_field_name(t, 2, "zzz"));
 
         ASSERT_OK(table_add_many(t,
@@ -715,6 +717,8 @@ TEST(vertical) {
                                  TABLE_FIELD, "quux", TABLE_STRING, "asdf", TABLE_SET_JSON_FIELD_NAME, "custom-quux",
                                  TABLE_FIELD, "lllllllllllo", TABLE_STRING, "jjjjjjjjjjjjjjjjj"));
 
+        ASSERT_OK(table_set_json_field_name(t, 1, "DIMPFELMOSER"));
+        ASSERT_OK(table_set_json_field_name(t, 1, NULL));
         ASSERT_OK(table_set_json_field_name(t, 1, "dimpfelmoser"));
 
         ASSERT_OK(table_format(t, &formatted));