3
0

test.tests 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #!/bin/sh
  2. # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPL v2, see file LICENSE for details.
  4. . testing.sh
  5. # testing "test name" "command" "expected result" "file input" "stdin"
  6. # file input will be file called "input"
  7. # test can create a file "actual" instead of writing to stdout
  8. # Need to call 'busybox test', otherwise shell builtin is used
  9. testing "test: should be false (1)" \
  10. "busybox test; echo \$?" \
  11. "1\n" \
  12. "" ""
  13. testing "test '': should be false (1)" \
  14. "busybox test ''; echo \$?" \
  15. "1\n" \
  16. "" ""
  17. testing "test !: should be true (0)" \
  18. "busybox test !; echo \$?" \
  19. "0\n" \
  20. "" ""
  21. testing "test a: should be true (0)" \
  22. "busybox test a; echo \$?" \
  23. "0\n" \
  24. "" ""
  25. testing "test --help: should be true (0)" \
  26. "busybox test --help; echo \$?" \
  27. "0\n" \
  28. "" ""
  29. testing "test -f: should be true (0)" \
  30. "busybox test -f; echo \$?" \
  31. "0\n" \
  32. "" ""
  33. testing "test ! -f: should be false (1)" \
  34. "busybox test ! -f; echo \$?" \
  35. "1\n" \
  36. "" ""
  37. testing "test a = a: should be true (0)" \
  38. "busybox test a = a; echo \$?" \
  39. "0\n" \
  40. "" ""
  41. testing "test -lt = -gt: should be false (1)" \
  42. "busybox test -lt = -gt; echo \$?" \
  43. "1\n" \
  44. "" ""
  45. testing "test a -a !: should be true (0)" \
  46. "busybox test a -a !; echo \$?" \
  47. "0\n" \
  48. "" ""
  49. testing "test -f = a -o b: should be true (0)" \
  50. "busybox test -f = a -o b; echo \$?" \
  51. "0\n" \
  52. "" ""
  53. testing "test ! a = b -a ! c = c: should be false (1)" \
  54. "busybox test ! a = b -a ! c = c; echo \$?" \
  55. "1\n" \
  56. "" ""
  57. testing "test ! a = b -a ! c = d: should be true (0)" \
  58. "busybox test ! a = b -a ! c = d; echo \$?" \
  59. "0\n" \
  60. "" ""
  61. exit $FAILCOUNT