diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/diagnostic.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/diagnostic.c b/test/diagnostic.c index 9245d21..8954473 100644 --- a/test/diagnostic.c +++ b/test/diagnostic.c @@ -118,7 +118,25 @@ static int fixme_test(void) static int info_test(void) { - return 77; + size_t i; + int usearg; + int ret; + + static const char *in[] = {"", "test", "test number is %zu", "%zu tests ran"}; + static const char *expected[] = {"info:\n", "info:test\n", "info:test number is 3\n", "info:4 tests ran\n"}; + + /* `ninja test` seems to be intercepting stdout, so we cannot test the default outstream */ + rin_diag_set_outstream(rin_diag_info, stderr); + + for (i = 0; i < arrlen(in); ++i) { + usearg = i < (arrlen(in) / 2) ? 0 : 1; + ret = test_default_channels(in[i], expected[i], i, usearg, rin_info); + } + + /* restore the default, kind of */ + rin_diag_set_outstream(rin_diag_info, stdout); + + return ret; } static int prefix_test(void) |