tr.tests 759 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. # Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPL v2, see file LICENSE for details.
  4. . ./testing.sh
  5. # testing "description" "arguments" "result" "infile" "stdin"
  6. testing "tr does not treat [] in [a-z] as special" \
  7. "tr '[q-z]' '_Q-Z+'" \
  8. "_QWe+" "" "[qwe]"
  9. testing "tr understands 0-9A-F" \
  10. "tr -cd '[0-9A-F]'" \
  11. "19AF" "" "19AFH\n"
  12. testing "tr understands [:xdigit:]" \
  13. "tr -cd '[:xdigit:]'" \
  14. "19AF" "" "19AFH\n"
  15. testing "tr does not stop after [:digit:]" \
  16. "tr '[:digit:]y-z' 111111111123" \
  17. "111abcx23\n" "" "789abcxyz\n"
  18. testing "tr has correct xdigit sequence" \
  19. "tr '[:xdigit:]Gg' 1111111151242222333330xX" \
  20. "#1111111151242222x333330X\n" "" \
  21. "#0123456789ABCDEFGabcdefg\n"
  22. exit $FAILCOUNT