chiark
/
gitweb
/
~mdw
/
disorder
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
343c64f
)
exercise byte_fprintf
author
Richard Kettlewell
<rjk@greenend.org.uk>
Sat, 26 Apr 2008 14:08:59 +0000
(15:08 +0100)
committer
Richard Kettlewell
<rjk@greenend.org.uk>
Sat, 26 Apr 2008 14:08:59 +0000
(15:08 +0100)
lib/t-printf.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/t-printf.c
b/lib/t-printf.c
index 057b5037452d945ca70531a4d42d013a22e32fcb..be57bc81de876637612ce85a81e48a5cad77c0f0 100644
(file)
--- a/
lib/t-printf.c
+++ b/
lib/t-printf.c
@@
-30,6
+30,7
@@
void test_printf(void) {
ptrdiff_t p;
char *cp;
char buffer[16];
ptrdiff_t p;
char *cp;
char buffer[16];
+ FILE *fp;
fprintf(stderr, "test_printf\n");
check_string(do_printf("%d", 999), "999");
fprintf(stderr, "test_printf\n");
check_string(do_printf("%d", 999), "999");
@@
-122,6
+123,13
@@
void test_printf(void) {
i = byte_asprintf(&cp, f);
insist(i == -1);
}
i = byte_asprintf(&cp, f);
insist(i == -1);
}
+
+ fp = tmpfile();
+ insist(byte_fprintf(fp, "%10s\n", "wibble") == 11);
+ rewind(fp);
+ insist(fgets(buffer, sizeof buffer, fp) == buffer);
+ check_string(buffer, " wibble\n");
+ fclose(fp);
}
/*
}
/*