test.tests 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 a: should be true (0)" \
  18. "busybox test a; echo \$?" \
  19. "0\n" \
  20. "" ""
  21. testing "test --help: should be true (0)" \
  22. "busybox test --help; echo \$?" \
  23. "0\n" \
  24. "" ""
  25. testing "test -f: should be true (0)" \
  26. "busybox test -f; echo \$?" \
  27. "0\n" \
  28. "" ""
  29. testing "test ! -f: should be false (1)" \
  30. "busybox test ! -f; echo \$?" \
  31. "1\n" \
  32. "" ""
  33. testing "test a = a: should be true (0)" \
  34. "busybox test a = a; echo \$?" \
  35. "0\n" \
  36. "" ""
  37. testing "test -lt = -gt: should be false (1)" \
  38. "busybox test -lt = -gt; echo \$?" \
  39. "1\n" \
  40. "" ""
  41. testing "test -f = a -o b: should be true (0)" \
  42. "busybox test -f = a -o b; echo \$?" \
  43. "0\n" \
  44. "" ""
  45. testing "test ! a = b -a ! c = c: should be false (1)" \
  46. "busybox test ! a = b -a ! c = c; echo \$?" \
  47. "1\n" \
  48. "" ""
  49. testing "test ! a = b -a ! c = d: should be true (0)" \
  50. "busybox test ! a = b -a ! c = d; echo \$?" \
  51. "0\n" \
  52. "" ""
  53. exit $FAILCOUNT