blob: 2d0a201b784572d5d84003161322587db9f3ab96 [file] [log] [blame]
Denis Vlasenkocc08ad22008-08-03 19:12:25 +00001#!/bin/sh
2# Copyright 2008 by Denys Vlasenko
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02003# Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenkocc08ad22008-08-03 19:12:25 +00004
Mike Frysingercaa79402009-11-04 18:41:22 -05005. ./testing.sh
Denis Vlasenkocc08ad22008-08-03 19:12:25 +00006
7# testing "test name" "command" "expected result" "file input" "stdin"
8
Denis Vlasenko82ad0322008-08-04 21:30:55 +00009testing "xargs -E _ stops on underscore" \
10 "xargs -E _" \
Denis Vlasenkocc08ad22008-08-03 19:12:25 +000011 "a\n" \
12 "" "a\n_\nb\n"
13
Denis Vlasenko82ad0322008-08-04 21:30:55 +000014testing "xargs -E ''" \
15 "xargs -E ''" \
16 "a _ b\n" \
17 "" "a\n_\nb\n"
18
Denis Vlasenkocc08ad22008-08-03 19:12:25 +000019testing "xargs -e without param" \
20 "xargs -e" \
21 "a _ b\n" \
22 "" "a\n_\nb\n"
23
Denis Vlasenko82ad0322008-08-04 21:30:55 +000024testing "xargs does not stop on underscore ('new' GNU behavior)" \
25 "xargs" \
26 "a _ b\n" \
27 "" "a\n_\nb\n"
28
Denys Vlasenkod5fa1a02010-06-13 03:43:43 +020029testing "xargs -s7 can take one-char input" \
Denys Vlasenkoaaa24e02010-06-13 12:43:54 +020030 "xargs -s7 echo" \
Denys Vlasenkod5fa1a02010-06-13 03:43:43 +020031 "a\n" \
32 "" "a\n"
33
Denys Vlasenkoaaa24e02010-06-13 12:43:54 +020034testing "xargs -sNUM test 1" \
35 "xargs -ts25 echo 2>&1 >/dev/null" \
36 "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" \
37 "" "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 00\n"
38
39testing "xargs -sNUM test 2" \
40 "xargs -ts25 echo 1 2>&1 >/dev/null" \
41 "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" \
42 "" "2 3 4 5 6 7 8 9 0 2 3 4 5 6 7 8 9 00\n"
43
Denis Vlasenkocc08ad22008-08-03 19:12:25 +000044exit $FAILCOUNT