blob: 5cca299ac92f22ab9c3a3d484152d6623456dc3f [file] [log] [blame]
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +00001#!/bin/sh
2
3# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
Denys Vlasenko0ef64bd2010-08-16 20:14:46 +02004# Licensed under GPLv2, see file LICENSE in this source tree.
Denis Vlasenko1bfcc8b2009-03-01 04:50:18 +00005
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
Leonid Lisovskiy1538c972010-07-29 11:05:30 +040018optional 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
Leonid Lisovskiy1538c972010-07-29 11:05:30 +040024optional 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
Leonid Lisovskiy1538c972010-07-29 11:05:30 +040030optional 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