unit-tests: Check printing of strings having zero length
authorMartin Willi <martin@revosec.ch>
Fri, 25 Oct 2013 12:41:28 +0000 (14:41 +0200)
committerMartin Willi <martin@revosec.ch>
Wed, 6 Nov 2013 09:31:07 +0000 (10:31 +0100)
src/libstrongswan/tests/suites/test_printf.c

index ad8c225..7d38c60 100644 (file)
@@ -48,6 +48,8 @@ START_TEST(test_printf_strings)
        verify("a bc def", "%s %s %s", "a", "bc", "def");
        verify("asd", "%.3s", "asdfg");
        verify("asdf", "%.*s", (int)4, "asdfg");
+       verify("", "%.0s", NULL);
+       verify("", "%.*s", (int)0, NULL);
        verify("  asdf", "%6s", "asdf");
        verify("  asdf", "%+6s", "asdf");
        verify("asdf  ", "%-6s", "asdf");