blob: 2c0a9d196af217c3377e6e13a95c42f9038a5c24 [file] [log] [blame]
Rob Landley998dbee2006-04-19 22:22:06 +00001run_tr ()
2{
3 echo -n "echo '$1' | tr '$2' '$3': "
4 echo "$1" | $bb tr "$2" "$3"
5 echo
6}
7tr_test ()
8{
9 run_tr "cbaab" abc zyx
Denis Vlasenko9213a9e2006-09-17 16:28:10 +000010 run_tr "TESTING A B C" '[A-Z]' '[a-z]'
Rob Landley998dbee2006-04-19 22:22:06 +000011 run_tr "abc[]" "a[b" AXB
12 run_tr abc '[:alpha:]' A-ZA-Z
13 run_tr abc56 '[:alnum:]' A-ZA-Zxxxxxxxxxx
14 run_tr 012 '[:digit:]' abcdefghi
15 run_tr abc56 '[:lower:]' '[:upper:]'
16 run_tr " " '[:space:]' 12345
17 run_tr " " '[:blank:]' 12
18 run_tr 'a b' '[= =]' X
19 run_tr "[:" '[:' ab
Bernhard Reutner-Fischereceecea2007-03-30 14:43:27 +000020 run_tr " .,:" '[:punct:]' 12
21 run_tr " .,:" '[:cntrl:]' 12
Rob Landley998dbee2006-04-19 22:22:06 +000022}
Eric Andersen650fe632004-04-06 11:10:30 +000023
Rob Landley998dbee2006-04-19 22:22:06 +000024bb= tr_test > logfile.gnu
25bb=busybox tr_test > logfile.bb
Bernhard Reutner-Fischereceecea2007-03-30 14:43:27 +000026diff -u logfile.gnu logfile.bb