- pull r17554 and r17555 from trunk:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 27 Jan 2007 22:47:08 +0000 (22:47 -0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Sat, 27 Jan 2007 22:47:08 +0000 (22:47 -0000)
- fix testsuite and add test for sum

Makefile.custom
testsuite/sum.tests [new file with mode: 0755]

index e976e739e8194f5cdc01e18eaf1065090277f3b5..0cc40a667926155cac235a11dae2e28a75b7960c 100644 (file)
@@ -38,9 +38,9 @@ ifneq ($(strip $(DO_INSTALL_LIBS)),n)
        done
 endif
 
-check test: busybox
+check test: busybox busybox.links
        bindir=$(objtree) srcdir=$(srctree)/testsuite SED="$(SED)" \
-       $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:1=),-v)
+       $(SHELL) $(srctree)/testsuite/runtest $(if $(KBUILD_VERBOSE:0=),-v)
 
 .PHONY: release
 release: distclean
diff --git a/testsuite/sum.tests b/testsuite/sum.tests
new file mode 100755 (executable)
index 0000000..0993f03
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# unit test for sum.
+# Copyright 2007 by Bernhard Fischer
+# Licensed under GPL v2 or later, see file LICENSE for details.
+
+# AUDIT: Unit tests for sum
+
+. testing.sh
+
+# testing "test name" "options" "expected result" "file input" "stdin"
+#   file input will be file called "input"
+#   test can create a file "actual" instead of writing to stdout
+
+testing "sum -r file doesn't print file's name" \
+        "sum -r $0 | grep -c $0 && echo wrongly_printed_filename || echo yes" \
+       "0\nyes\n" "" ""
+testing "sum -r file file does print both names" \
+        "sum -r $0 $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \
+       "2\nyes\n" "" ""
+testing "sum -s file does print file's name" \
+        "sum -s $0 | grep -c $0 && echo yes || echo wrongly_omitted_filename" \
+       "1\nyes\n" "" ""
+exit $FAILCOUNT