aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormaqsood3525@live.com <maqsood3525@live.com>2018-08-29 23:27:17 +0100
committerRob Landley <rob@landley.net>2018-08-29 17:56:19 -0500
commit198b2b48345c175dc184258677fd48043dc1a78b (patch)
treea0a1a6f41fdf9e218ba30a4444d3683217be126f /tests
parente579e69656b368bc6c344b5756436fcbdc7cdbd0 (diff)
downloadtoybox-198b2b48345c175dc184258677fd48043dc1a78b.tar.gz
added fold test for discussion
Diffstat (limited to 'tests')
-rwxr-xr-xtests/fold.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/fold.test b/tests/fold.test
new file mode 100755
index 00000000..ab3353dd
--- /dev/null
+++ b/tests/fold.test
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+[ -f testing.sh ] && . testing.sh
+
+#testing "name" "command" "result" "infile" "stdin"
+
+#copied from gnu, but according to what i understand the output should be.
+
+testing "fold_test_1" "fold -w2 -s" "a\t\n" "" "a\t"
+testing "fold_test_2" "fold -w4 -s" "abcd\nef \nd\n" "" "abcdef d\n"
+testing "fold_test_3" "fold -w4 -s" "a \ncd \nfgh\n" "" "a cd fgh\n"
+testing "fold_test_4" "fold -w4 -s" "abc \nef\n" "" "abc ef\n"
+
+#the question i posted
+testing "fold_test_5" "fold -w1" "a\nb\nc\nd\n" "" "abcd"