3
0

test.tests 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/sh
  2. # Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
  3. # Licensed under GPLv2, see file LICENSE in this source tree.
  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. testing "test '!' = '!': should be true (0)" \
  62. "busybox test '!' = '!'; echo \$?" \
  63. "0\n" \
  64. "" ""
  65. testing "test '(' = '(': should be true (0)" \
  66. "busybox test '(' = '('; echo \$?" \
  67. "0\n" \
  68. "" ""
  69. testing "test '!' '!' = '!': should be false (1)" \
  70. "busybox test '!' '!' = '!'; echo \$?" \
  71. "1\n" \
  72. "" ""
  73. testing "test '!' '(' = '(': should be false (1)" \
  74. "busybox test '!' '(' = '('; echo \$?" \
  75. "1\n" \
  76. "" ""
  77. exit $FAILCOUNT