From: Ben Pfaff Date: Sat, 30 May 2009 04:43:33 +0000 (-0700) Subject: datasheet-test: Fix printing of string values in error messages. X-Git-Tag: v0.7.3~64 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=67b337574982476bfe821f78312a4588f55401b3;p=pspp-builds.git datasheet-test: Fix printing of string values in error messages. --- diff --git a/tests/data/datasheet-test.c b/tests/data/datasheet-test.c index 5eeb3553..56c8d26e 100644 --- a/tests/data/datasheet-test.c +++ b/tests/data/datasheet-test.c @@ -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)); }