busybox/testsuite/tr.tests
Denis Vlasenko 1bfcc8b08e tr: support [:xdigit:], fix handling of ranges and [x]'s.
add testsuite entry for each of 3 bugs fixed.

function                                             old     new   delta      
static.classes                                        73      82      +9      
expand                                              1738    1743      +5      
complement                                            74      72      -2      
tr_main                                              472     463      -9      
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 14/-11)              Total: 3 bytes
2009-03-01 04:50:18 +00:00

23 lines
484 B
Bash

#!/bin/sh
# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
# Licensed under GPL v2, see file LICENSE for details.
. testing.sh
# testing "description" "arguments" "result" "infile" "stdin"
testing "tr does not treat [] in [a-z] as special" \
"tr '[q-z]' '_Q-Z+'" \
"_QWe+" "" "[qwe]"
testing "tr understands 0-9A-F" \
"tr -cd '[0-9A-F]'" \
"19AF" "" "19AFH\n"
testing "tr understands [:xdigit:]" \
"tr -cd '[:xdigit:]'" \
"19AF" "" "19AFH\n"
exit $FAILCOUNT