time.tests 868 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. # Copyright 2024 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPLv2, see file LICENSE in this source tree.
  4. . ./testing.sh
  5. # testing "description" "arguments" "result" "infile" "stdin"
  6. testing "time -f trailing backslash" \
  7. "time -f 'abc\' sleep 0 2>&1" \
  8. 'abc?\sleep\n' '' ''
  9. # ^^^^^^^^^^^^^^ this is what GNU time version 1.9 prints
  10. testing "time -f trailing percent" \
  11. "time -f 'abc%' sleep 0 2>&1" \
  12. 'abc?' '' ''
  13. testing "time -f undefined backslash" \
  14. "time -f 'abc\^def' sleep 0 2>&1" \
  15. 'abc?\^def\n' '' ''
  16. testing "time -f undefined percent" \
  17. "time -f 'abc%^def' sleep 0 2>&1" \
  18. 'abc?^def\n' '' ''
  19. testing "time -f backslash tab and newline" \
  20. "time -f 'abc\ndef\txyz' sleep 0 2>&1" \
  21. 'abc
  22. def xyz
  23. ' '' ''
  24. testing "time -f percent percent" \
  25. "time -f 'abc%%def' sleep 0 2>&1" \
  26. 'abc%def\n' '' ''
  27. exit $FAILCOUNT