2008-08-04 00:42:25 +05:30
|
|
|
#!/bin/sh
|
|
|
|
# Copyright 2008 by Denys Vlasenko
|
2010-08-16 23:44:46 +05:30
|
|
|
# Licensed under GPLv2, see file LICENSE in this source tree.
|
2008-08-04 00:42:25 +05:30
|
|
|
|
2009-11-05 05:11:22 +05:30
|
|
|
. ./testing.sh
|
2008-08-04 00:42:25 +05:30
|
|
|
|
|
|
|
# testing "test name" "command" "expected result" "file input" "stdin"
|
|
|
|
|
2008-08-05 03:00:55 +05:30
|
|
|
testing "xargs -E _ stops on underscore" \
|
|
|
|
"xargs -E _" \
|
2008-08-04 00:42:25 +05:30
|
|
|
"a\n" \
|
|
|
|
"" "a\n_\nb\n"
|
|
|
|
|
2008-08-05 03:00:55 +05:30
|
|
|
testing "xargs -E ''" \
|
|
|
|
"xargs -E ''" \
|
|
|
|
"a _ b\n" \
|
|
|
|
"" "a\n_\nb\n"
|
|
|
|
|
2008-08-04 00:42:25 +05:30
|
|
|
testing "xargs -e without param" \
|
|
|
|
"xargs -e" \
|
|
|
|
"a _ b\n" \
|
|
|
|
"" "a\n_\nb\n"
|
|
|
|
|
2008-08-05 03:00:55 +05:30
|
|
|
testing "xargs does not stop on underscore ('new' GNU behavior)" \
|
|
|
|
"xargs" \
|
|
|
|
"a _ b\n" \
|
|
|
|
"" "a\n_\nb\n"
|
|
|
|
|
2010-06-13 07:13:43 +05:30
|
|
|
testing "xargs -s7 can take one-char input" \
|
2010-06-13 16:13:54 +05:30
|
|
|
"xargs -s7 echo" \
|
2010-06-13 07:13:43 +05:30
|
|
|
"a\n" \
|
|
|
|
"" "a\n"
|
|
|
|
|
2010-06-13 16:13:54 +05:30
|
|
|
testing "xargs -sNUM test 1" \
|
|
|
|
"xargs -ts25 echo 2>&1 >/dev/null" \
|
|
|
|
"echo 1 2 3 4 5 6 7 8 9 0\n""echo 1 2 3 4 5 6 7 8 9\n""echo 00\n" \
|
|
|
|
"" "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 00\n"
|
|
|
|
|
|
|
|
testing "xargs -sNUM test 2" \
|
|
|
|
"xargs -ts25 echo 1 2>&1 >/dev/null" \
|
|
|
|
"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"
|
|
|
|
|
2020-01-24 18:46:45 +05:30
|
|
|
# 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" \
|
|
|
|
"" ""
|
|
|
|
SKIP=
|
|
|
|
|
2008-08-04 00:42:25 +05:30
|
|
|
exit $FAILCOUNT
|