OSDN Git Service

Merge tag 'android-8.1.0_r1' into oreo-x86
[android-x86/external-toybox.git] / tests / paste.test
1 #!/bin/bash
2
3 [ -f testing.sh ] && . testing.sh
4
5 #testing "name" "command" "result" "infile" "stdin"
6
7 UTFTEST="$(echo -e '\xcc\xb4\xcc\x97\xcc\x9e\xcc\xa0\x65')"
8 echo -e "one1\none2\none3" > one
9 echo -e "two1\ntwo2\ntwo3" > two
10 touch three four
11 echo five > five
12 testing "" "paste one two" "one1\ttwo1\none2\ttwo2\none3\ttwo3\n" "" ""
13 testing "" "paste -s one two" "one1\tone2\tone3\ntwo1\ttwo2\ttwo3\n" "" ""
14 testing "" "paste -s three four" "\n\n" "" ""
15 testing "" "paste three four" "" "" ""
16 testing "" "paste - - -" "uno\tdos\tdesqview\nunix\t\t\n" "" "uno\ndos\ndesqview\nunix\n"
17 testing "" "paste - - - -d ''" "unodosdesqview\nunix\n" "" "uno\ndos\ndesqview\nunix\n"
18 testing "" "paste one two one two" \
19   "one1\ttwo1\tone1\ttwo1\none2\ttwo2\tone2\ttwo2\none3\ttwo3\tone3\ttwo3\n" \
20   "" ""
21 testing "" "paste five three two" "five\t\ttwo1\n\t\ttwo2\n\t\ttwo3\n" "" ""
22 testing "" "paste -d '私\0${UTFTEST}q' - - - - - - " \
23   "one私twothree${UTFTEST}fourqfive私six\n7私89${UTFTEST}q私\n" \
24   "" "one\ntwo\nthree\nfour\nfive\nsix\n7\n8\n9\n"
25 rm -f one two three four
26 unset UTFTEST
27
28 # test -d \n
29 # test -d \x
30 # test