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