]> git.draconx.ca Git - cdecl99.git/commitdiff
tests: Work around some ancient printf bugs.
authorNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 05:34:27 +0000 (00:34 -0500)
committerNick Bowler <nbowler@draconx.ca>
Tue, 5 Dec 2023 05:36:41 +0000 (00:36 -0500)
Some very old printf implementations (e.g., on ULTRIX 4.5) do not
support negative precision with %.*s conversions in order to behave
as if the precision was omitted.

It is easy to change the rendertest program to avoid this problem,
so let's change it.

t/rendertest.c
tests/internal.at

index 93574e2ef9a5b1ce611ab1a95135196ccc072535..14faafb28990544f38645ccf24500120334efbac 100644 (file)
@@ -85,7 +85,7 @@ static int do_test(char *line, unsigned long n, int mode)
                return -1;
        }
 
-       printf("%lu %.*s\n", (unsigned long)rc, -(n>0), line);
+       printf(n > 0 ? "%lu %s\n" : "%lu\n", (unsigned long)rc, line);
        cdecl_free(decl);
        return 0;
 }
index 859807354d3aec74be7901e05c7d30e1e8354e92..3fa785a6055f1e8210ed6ee672d37b5d8f49ce60 100644 (file)
@@ -83,8 +83,8 @@ int x[1234567890]
 ]])
 
 AT_CHECK([rendertest -n 0 <input], [0],
-[[15 @&t@
-17 @&t@
+[[15
+17
 ]])
 
 AT_CHECK([rendertest -n 10 <input], [0],
@@ -103,8 +103,8 @@ type array 123456789 of int
 ]])
 
 AT_CHECK([rendertest --english -n 0 <input], [0],
-[[16 @&t@
-27 @&t@
+[[16
+27
 ]])
 
 AT_CHECK([rendertest --english -n 15 <input], [0],