]> mj.ucw.cz Git - libucw.git/commitdiff
tableprinter: update of tests of table_set_col_order_by_name
authorRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 12:15:09 +0000 (14:15 +0200)
committerRobert Kessl <kesslr@centrum.cz>
Wed, 30 Jul 2014 12:15:09 +0000 (14:15 +0200)
ucw/table-test-2.c
ucw/table-test-2.t
ucw/table.c

index cb56b14e9115a6f99e7371bc449f7c289b356396..854cfd87b14514a64b0fc0bef225719b6444b52d 100644 (file)
@@ -81,7 +81,7 @@ static void do_test2(void)
   out = bfdopen_shared(1, 4096);
   struct table *tbl = table_init(&test_tbl2);
   table_set_col_order_by_name(tbl, "");
-  const char *err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],size[MB,KB]");
+  const char *err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],ts[],size[MB,KB]");
   if(err) {
     opt_failure("err in table_set_option_value: '%s'.", err);
     abort();
@@ -127,7 +127,7 @@ static void do_test3(void)
 
   tbl = table_init(&test_tbl2);
   table_set_col_order_by_name(tbl, "");
-  err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[timestamp],size[MB,KB");
+  err = table_set_option_value(tbl, "cols", "size[MB,TB,KB],size[MB],size[GB],size[TB],size[auto],ts[datetime],ts[],size[MB,KB");
   bprintf(out, "Error occured: %s\n", err);
   table_cleanup(tbl);
 
index 90d121374031e5a850a6cfed839d664878426cce..0bbbbabdd24d03374afc94845edab4258d757d83 100644 (file)
@@ -6,10 +6,10 @@ Out <<EOF
          4096MB           1403685533
             4GB  2014-06-25 08:38:53
             4TB  2014-06-25 08:38:53
-           size            size            size            size            size                   ts                   ts            size
-         4096KB             4MB             0GB             0TB             4MB  2014-06-25 08:38:53           1403685533          4096KB
-      4194304KB          4096MB             4GB             0TB             4GB  2014-06-25 08:38:53           1403685533       4194304KB
-   4294967296KB       4194304MB          4096GB             4TB             4TB  2014-06-25 08:38:53           1403685533    4294967296KB
+           size            size            size            size            size                   ts                   ts                   ts            size
+         4096KB             4MB             0GB             0TB             4MB  2014-06-25 08:38:53           1403685533           1403685533          4096KB
+      4194304KB          4096MB             4GB             0TB             4GB  2014-06-25 08:38:53           1403685533           1403685533       4194304KB
+   4294967296KB       4194304MB          4096GB             4TB             4TB  2014-06-25 08:38:53           1403685533           1403685533    4294967296KB
 Error occured: (null)
 Error occured: Invalid column definition, missing ']'.
 Error occured: Invalid column definition, missing ']'.
index b00979c207057d702eafabe8d6fb2dd6aed80969..c48eb8ba3428c18a39dcce3da22ea621f26ed464 100644 (file)
@@ -254,7 +254,8 @@ static char **table_parse_col_arg2(char *col_def)
 
     col_opt = next;
   }
-  *GARY_PUSH(result) = col_opt;
+  if(strlen(col_opt) > 0)
+    *GARY_PUSH(result) = col_opt;
 
   return result;
 }