From 0ed8e4866853193022e6916609e21e0d8321e206 Mon Sep 17 00:00:00 2001 From: Bryan Schumaker Date: Sun, 28 Jul 2013 22:36:08 -0400 Subject: [PATCH] tests: Various improvements - Don't be verbose when removing files. - Reverse diff order so output makes more sense. - Only strip whitespace from the end of lines. Signed-off-by: Bryan Schumaker --- lib/test.cpp | 2 +- tests/Sconscript | 4 ++-- tests/file/compile.cpp | 2 +- tests/file/open-debug.good | 3 --- tests/file/open.good | 3 --- 5 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/test.cpp b/lib/test.cpp index 2d45ba5d..1b7a4e77 100644 --- a/lib/test.cpp +++ b/lib/test.cpp @@ -10,7 +10,7 @@ /* A bit hackish, but it works... */ static void rm_dir(const char *dir) { - std::string cmd = "rm -frv "; + std::string cmd = "rm -rf "; cmd += dir; cmd += "/ocarina-test"; system(cmd.c_str()); diff --git a/tests/Sconscript b/tests/Sconscript index 78aa4fc7..b1495a03 100644 --- a/tests/Sconscript +++ b/tests/Sconscript @@ -16,11 +16,11 @@ def run_test(target, source, env): if (len(source) == 2) and (ret == 0): good = str(source[1]) - if (subprocess.call("diff -u %s %s" % (res, good), shell = True) != 0): + if (subprocess.call("diff -u %s %s" % (good, res), shell = True) != 0): print else: for line in open( str(target[0]) ): - print line.strip() + print line.rstrip() print def Test(group, src): diff --git a/tests/file/compile.cpp b/tests/file/compile.cpp index 68cedbbb..534c7f0a 100644 --- a/tests/file/compile.cpp +++ b/tests/file/compile.cpp @@ -1,5 +1,5 @@ /* - * Test that a file object can be created. + * Test that a file object can be created and resolves paths correctly. */ #include #include diff --git a/tests/file/open-debug.good b/tests/file/open-debug.good index a685f26c..664bd6db 100644 --- a/tests/file/open-debug.good +++ b/tests/file/open-debug.good @@ -1,6 +1,3 @@ -removed ‘/home/anna/.local/share/ocarina-test/test.4’ -removed ‘/home/anna/.local/share/ocarina-test/test.3’ -removed directory: ‘/home/anna/.local/share/ocarina-test’ ERROR: NOT_OPEN is not a legal OpenMode (/home/anna/.local/share/ocarina-test/test.0) Test 0: Passed diff --git a/tests/file/open.good b/tests/file/open.good index 0b588752..f91e2afd 100644 --- a/tests/file/open.good +++ b/tests/file/open.good @@ -1,6 +1,3 @@ -removed ‘/home/anna/.local/share/ocarina-test/test.4’ -removed ‘/home/anna/.local/share/ocarina-test/test.3’ -removed directory: ‘/home/anna/.local/share/ocarina-test’ Test 0: Passed