blob: a1f83bfc60ec474cbe4494022c59bdc0d4855417 [file] [log] [blame]
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +00001#!/bin/sh
2
3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details.
5
Mike Frysingercaa79402009-11-04 18:41:22 -05006. ./testing.sh
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +00007
8# testing "description" "arguments" "result" "infile" "stdin"
9
10testing "tr does not treat [] in [a-z] as special" \
11 "tr '[q-z]' '_Q-Z+'" \
12 "_QWe+" "" "[qwe]"
13
14testing "tr understands 0-9A-F" \
15 "tr -cd '[0-9A-F]'" \
16 "19AF" "" "19AFH\n"
17
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020018optional CONFIG_FEATURE_TR_CLASSES
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +000019testing "tr understands [:xdigit:]" \
20 "tr -cd '[:xdigit:]'" \
21 "19AF" "" "19AFH\n"
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020022SKIP=
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +000023
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020024optional CONFIG_FEATURE_TR_CLASSES
Denis Vlasenko37ad6b32009-03-02 12:07:15 +000025testing "tr does not stop after [:digit:]" \
26 "tr '[:digit:]y-z' 111111111123" \
27 "111abcx23\n" "" "789abcxyz\n"
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020028SKIP=
Denis Vlasenko37ad6b32009-03-02 12:07:15 +000029
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020030optional CONFIG_FEATURE_TR_CLASSES
Denis Vlasenko37ad6b32009-03-02 12:07:15 +000031testing "tr has correct xdigit sequence" \
32 "tr '[:xdigit:]Gg' 1111111151242222333330xX" \
33 "#1111111151242222x333330X\n" "" \
34 "#0123456789ABCDEFGabcdefg\n"
Denys Vlasenkobfa1b2e2010-05-11 03:53:57 +020035SKIP=
Denis Vlasenko37ad6b32009-03-02 12:07:15 +000036
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +000037exit $FAILCOUNT