aboutsummaryrefslogtreecommitdiff
path: root/testsuite/tr
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-04-19 22:22:06 +0000
committerRob Landley <rob@landley.net>2006-04-19 22:22:06 +0000
commit998dbee6d9494c4dee29a2abe195d79d9b1c2e08 (patch)
tree3c5c6d2e1cfe06cb2fbd7bc41d5076b75976b595 /testsuite/tr
parent5076eb4af923ec2d3355450cfa356dbac9f5aeca (diff)
downloadbusybox-998dbee6d9494c4dee29a2abe195d79d9b1c2e08.tar.gz
Patch from Jean Wolter:
it looks like the introduced support for character classes and equivalence classes is not correct. The attached patch tries to fix some symptoms and tries to make tr behave like gnu tr for the added test cases. The patch  - removes if clauses with side effects  - fixes handling of buffer pointer (strcat added characters to the    buffer without increasing the buffer pointer)  - re-arranges character classes to match ASCII order regards, Jean
Diffstat (limited to 'testsuite/tr')
-rw-r--r--testsuite/tr/tr-works29
1 files changed, 22 insertions, 7 deletions
diff --git a/testsuite/tr/tr-works b/testsuite/tr/tr-works
index 8753a3f28..b7a6e8df7 100644
--- a/testsuite/tr/tr-works
+++ b/testsuite/tr/tr-works
@@ -1,9 +1,24 @@
-echo "cbaab" | tr abc zyx > logfile.gnu
-echo "TESTING A B C" | tr [A-Z] [a-z] >> logfile.gnu
-echo abc[] | tr a[b AXB >> logfile.gnu
-
-echo "cbaab" | busybox tr abc zyx > logfile.bb
-echo "TESTING A B C" | busybox tr [A-Z] [a-z] >> logfile.bb
-echo abc[] | busybox tr a[b AXB >> logfile.bb
+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
+}
+bb= tr_test > logfile.gnu
+bb=busybox tr_test > logfile.bb
cmp logfile.gnu logfile.bb