tr.tests 882 B

12345678910111213141516171819202122232425262728293031323334353637
  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. optional CONFIG_FEATURE_TR_CLASSES
  13. testing "tr understands [:xdigit:]" \
  14. "tr -cd '[:xdigit:]'" \
  15. "19AF" "" "19AFH\n"
  16. SKIP=
  17. optional CONFIG_FEATURE_TR_CLASSES
  18. testing "tr does not stop after [:digit:]" \
  19. "tr '[:digit:]y-z' 111111111123" \
  20. "111abcx23\n" "" "789abcxyz\n"
  21. SKIP=
  22. optional CONFIG_FEATURE_TR_CLASSES
  23. testing "tr has correct xdigit sequence" \
  24. "tr '[:xdigit:]Gg' 1111111151242222333330xX" \
  25. "#1111111151242222x333330X\n" "" \
  26. "#0123456789ABCDEFGabcdefg\n"
  27. SKIP=
  28. exit $FAILCOUNT