aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2012-11-26 20:34:36 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2012-11-26 20:34:36 +0100
commitdb2df835da9893930a12a62b30e8893599ae540f (patch)
treef9e91d28553329095c1bec6fab87451770526fea
parent0715a4433cc2c602458cbcb2bf0b1de15d63439b (diff)
downloadcalcurse-db2df835da9893930a12a62b30e8893599ae540f.tar.gz
calcurse-db2df835da9893930a12a62b30e8893599ae540f.zip
run-test.c: Return failure if actual output is too short
We always terminated run-test when reached the end of the expected output and returned success if actual output and expected output were the same up to this point. This resulted in run-test always returning successfully if the actual output was a prefix of the expected output, even if it was a proper prefix. Check if the expected output contains more data after string comparison has finished to ensure we only return successfully if both outputs are actually equal. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
-rw-r--r--test/run-test.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/run-test.c b/test/run-test.c
index c779be7..fb5bcb4 100644
--- a/test/run-test.c
+++ b/test/run-test.c
@@ -183,6 +183,9 @@ static int run_test(const char *name, int expect_failure)
}
}
+ if (fgets(buf2, BUFSIZ, fpin2))
+ ret = 0;
+
if (fpin1)
fclose(fpin1);
if (fpin2)