From f34dd44c298e93aec7b66edca410f16a291f8cb6 Mon Sep 17 00:00:00 2001 From: Hinko Kocevar Date: Sun, 6 Apr 2025 13:38:55 +0200 Subject: [PATCH] add more tests --- modules/libcom/test/multiline-expect.txt | 4 +++- modules/libcom/test/multiline-input.txt | 10 +++++++--- modules/libcom/test/readlineTest.c | 9 ++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/modules/libcom/test/multiline-expect.txt b/modules/libcom/test/multiline-expect.txt index 3500e481d..fc4e30020 100644 --- a/modules/libcom/test/multiline-expect.txt +++ b/modules/libcom/test/multiline-expect.txt @@ -8,9 +8,11 @@ 5 it is fine to spit words, or really chop them up! +6 start with backslash , fine with me but why? +7 have a trailing space after backslash \ - +8 not part of the string no. 7 # keep this one last 99 will not get to this line 'cause input file line has no newline diff --git a/modules/libcom/test/multiline-input.txt b/modules/libcom/test/multiline-input.txt index 182db6cd9..efaf13072 100644 --- a/modules/libcom/test/multiline-input.txt +++ b/modules/libcom/test/multiline-input.txt @@ -25,9 +25,13 @@ o\ p\ them up! +\ +6 start with backslash , fine with me but why? - - +# if there is a trailing char after the backslash that does not count as +# a multiline string +7 have a trailing space after backslash \ +8 not part of the string no. 7 # keep this one last -99 this one will not appear 'cause of no newline \ No newline at end of file +99 will not get to this line 'cause input file line has no newline diff --git a/modules/libcom/test/readlineTest.c b/modules/libcom/test/readlineTest.c index 7a14f7711..4e8b614da 100644 --- a/modules/libcom/test/readlineTest.c +++ b/modules/libcom/test/readlineTest.c @@ -20,7 +20,7 @@ MAIN(readlineTest) const char *input = ".." OSI_PATH_SEPARATOR "multiline-input.txt"; const char *expect = ".." OSI_PATH_SEPARATOR "multiline-expect.txt"; - testPlan(5); + testPlan(9); testDiag("open input file \"%s\"", input); FILE *fp_input = fopen(input, "r"); @@ -79,10 +79,13 @@ MAIN(readlineTest) size_t len_input = strlen(line_input); if (len_input != len_expect) { - testAbort("lines are not of same length: input %ld, expected %ld", len_input, len_expect); + testAbort("lines are not of same length:\n" + "input len %ld :\n\"%s\"\nexpected len %ld : \n\"%s\"", + len_input, line_input, len_expect, line_expect); } if (strncmp(line_input, line_expect, len_expect)) { - testAbort("lines are not the same:\ninput:\"%s\"\nexpected: \"%s\"", line_input, line_expect); + testAbort("lines are not the same:\ninput:\"%s\"\nexpected: \"%s\"", + line_input, line_expect); } testOk(1, "line \"%s\"", line_input); }