datasheet-test: Fix printing of string values in error messages.
authorBen Pfaff <blp@gnu.org>
Sat, 30 May 2009 04:43:33 +0000 (21:43 -0700)
committerBen Pfaff <blp@gnu.org>
Sun, 7 Jun 2009 04:11:17 +0000 (21:11 -0700)
tests/data/datasheet-test.c

index 5eeb355346cf98fb82ee227d5925cf3a2f420a71..56c8d26e44dbb74c02eb6838ffc0598b12b0717b 100644 (file)
@@ -258,11 +258,16 @@ check_datasheet (struct mc *mc, struct datasheet *ds,
               ds_put_format (&s, "row %zu:", row);
               for (col = 0; col < n_columns; col++)
                 {
+                  int width = caseproto_get_width (proto, col);
                   union value v;
-                  value_init (&v, 0);
+                  value_init (&v, width);
                   if (!datasheet_get_value (ds, row, col, &v))
                     NOT_REACHED ();
-                  ds_put_format (&s, " %g", v.f);
+                  if (width == 0)
+                    ds_put_format (&s, " %g", v.f);
+                  else
+                    ds_put_format (&s, " '%.*s'",
+                                   width, value_str (&v, width));
                 }
               mc_error (mc, "%s", ds_cstr (&s));
             }