aboutsummaryrefslogtreecommitdiff
path: root/testsuite/tr/tr-works
blob: 5e4a30ee40964e38778f64ae7e9422c2aefa1697 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# FEATURE: CONFIG_FEATURE_TR_CLASSES

run_tr ()
{
	$ECHO -n "echo '$1' | tr '$2' '$3': "
	echo "$1" | $bb tr "$2" "$3"
	echo
}
tr_test ()
{
	run_tr "cbaab"		abc 		zyx
	run_tr "TESTING A B C" 	'[A-Z]' 	'[a-z]'
	run_tr "abc[]" 		"a[b" 		AXB
	run_tr abc		'[:alpha:]' 	A-ZA-Z
	run_tr abc56		'[:alnum:]' 	A-ZA-Zxxxxxxxxxx
	run_tr 012		'[:digit:]' 	abcdefghi
	run_tr abc56		'[:lower:]' 	'[:upper:]'
	run_tr " 	"	'[:space:]' 	12345
	run_tr " 	"	'[:blank:]' 	12
	run_tr 'a b'		'[= =]' 	X
	run_tr "[:"		'[:' 		ab
	run_tr " 	.,:"	'[:punct:]'	12
	run_tr " 	.,:"	'[:cntrl:]'	12
}

bb=        tr_test > logfile.gnu
bb=busybox tr_test > logfile.bb
diff -u logfile.gnu logfile.bb