xargs: restore correct behaviour of -n option
[oweals/busybox.git] / testsuite / xargs.tests
index 6463252bfb6f1131d6dee46ee9546f241af2b969..159f1ff69190f151d42b2748cb66919feb128461 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Copyright 2008 by Denys Vlasenko
-# Licensed under GPL v2, see file LICENSE for details.
+# Licensed under GPLv2, see file LICENSE in this source tree.
 
 . ./testing.sh
 
@@ -41,4 +41,24 @@ testing "xargs -sNUM test 2" \
        "echo 1 2 3 4 5 6 7 8 9 0\n""echo 1 2 3 4 5 6 7 8 9\n""echo 1 00\n" \
        "" "2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 00\n"
 
+# see that we don't get "argument line too long",
+# but do see the last word, 99999, instead
+optional FEATURE_XARGS_SUPPORT_QUOTES
+testing "xargs argument line too long" \
+       "seq 10000 99999 | sed -e 's/^/\"/' -e 's/$/\"/' | xargs echo | grep -o 99999; echo \$?" \
+       "99999\n0\n" \
+       "" ""
+
+testing "xargs -n1" \
+       "xargs -n1 echo" \
+       "1\n2\n3\n4\n5\n" \
+       "" "1 2 3 4 5\n"
+
+testing "xargs -n2" \
+       "xargs -n2 echo" \
+       "1 2\n3 4\n5\n" \
+       "" "1 2 3 4 5\n"
+
+SKIP=
+
 exit $FAILCOUNT