3
0

head.tests 772 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. # Copyright 2018 Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
  3. # Licensed under GPLv2 or later, see file LICENSE in this source tree.
  4. . ./testing.sh
  5. # testing "test name" "command" "expected result" "file input" "stdin"
  6. cat <<EOF > head.input
  7. line 1
  8. line 2
  9. line 3
  10. line 4
  11. line 5
  12. line 6
  13. line 7
  14. line 8
  15. line 9
  16. line 10
  17. line 11
  18. line 12
  19. EOF
  20. testing "head (without args)" \
  21. "head head.input" \
  22. "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\nline 10\n" \
  23. "" ""
  24. testing "head -n <positive number>" \
  25. "head -n 2 head.input" \
  26. "line 1\nline 2\n" \
  27. "" ""
  28. optional FEATURE_FANCY_HEAD
  29. testing "head -n <negative number>" \
  30. "head -n -9 head.input" \
  31. "line 1\nline 2\nline 3\n" \
  32. "" ""
  33. SKIP=
  34. rm head.input
  35. exit $FAILCOUNT