aboutsummaryrefslogtreecommitdiff
path: root/testsuite/uniq.tests
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-09-07 04:18:36 +0000
committerRob Landley <rob@landley.net>2005-09-07 04:18:36 +0000
commit14efdc58ce064fd4e0601e7099aec1c54bdaba0b (patch)
tree1d3cc979d1d5f829176be54ffc7d4674db64b7e6 /testsuite/uniq.tests
parent99f61719cb5d3d6e403e7cb9645c8f6289bb9ca4 (diff)
downloadbusybox-14efdc58ce064fd4e0601e7099aec1c54bdaba0b.tar.gz
Don't comment warnings. Don't put #warnings about warnings. _FIX_ warnings.
This fixes the warning, and makes the binary smaller out of sheer pique. (Yes, since Manuel did this one it's nice tight code that took several attempts to shrink, but I was ticked.) Add the start of a test for uniq; this is about the first 1/3 of the tests we need for full susv3 coverage of uniq.
Diffstat (limited to 'testsuite/uniq.tests')
-rwxr-xr-xtestsuite/uniq.tests36
1 files changed, 36 insertions, 0 deletions
diff --git a/testsuite/uniq.tests b/testsuite/uniq.tests
new file mode 100755
index 000000000..dc37d0a32
--- /dev/null
+++ b/testsuite/uniq.tests
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# SUSv3 compliant uniq tests.
+# Copyright 2005 by Rob Landley <rob@landley.net>
+# Licensed under GPL v2, see file LICENSE for details.
+
+# AUDIT: Not full coverage of the spec yet.
+
+if [ ${#COMMAND} -eq 0 ]; then COMMAND=uniq; fi
+. testing.sh
+
+# The basic tests. These should work even with the small busybox.
+#-f skip fields
+#-s skip chars
+#-c occurrences
+#-d dups only
+#-u
+testing "uniq (default to stdin)" "" "one\ntwo\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq - (specify stdin)" "-" "one\ntwo\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq input (specify file)" "input" "one\ntwo\nthree\n" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+testing "uniq input outfile (two files)" "input actual > /dev/null" \
+ "one\ntwo\nthree\n" "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+#testing "uniq - outfile" "- outfile" "one\ntwo\nthree\n" \
+# "one\ntwo\ntwo\nthree\nthree\nthree\n" ""
+
+testing "uniq -d" "-d" "two\nthree\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+testing "uniq -c" "-c" " 1 one\n 2 two\n 3 three\n" "" \
+ "one\ntwo\ntwo\nthree\nthree\nthree\n"
+# testing "uniq -c -d"
+# testing "uniq infile"
+
+exit $FAILCOUNT