tap-numbers-leading-zero.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #! /bin/sh
  2. # Copyright (C) 2011-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # TAP support:
  17. # - how does TAP result numbers with leading zero fares?
  18. . test-init.sh
  19. . tap-setup.sh
  20. do_checks ()
  21. {
  22. run_make -O -e FAIL check
  23. count_test_results "$@"
  24. # Allow some normalization of leading zeros, without forcing it.
  25. LC_ALL=C sed -n 's/: all\.test 0*\([0-9]\)/: all.test \1/p' stdout > got
  26. cat exp
  27. cat got
  28. diff exp got
  29. }
  30. cat > all.test <<END
  31. 1..15
  32. ok 01
  33. ok 0002
  34. not ok 03
  35. not ok 0004
  36. ok 05 # SKIP
  37. ok 0006 # SKIP
  38. not ok 07 # TODO
  39. not ok 0008 # TODO
  40. ok 009
  41. ok 010
  42. ok 00000011
  43. not ok 0012
  44. ok 00000013 # SKIP
  45. not ok 0014 # TODO
  46. ok 00000015 # TODO
  47. END
  48. cat > exp <<END
  49. PASS: all.test 1
  50. PASS: all.test 2
  51. FAIL: all.test 3
  52. FAIL: all.test 4
  53. SKIP: all.test 5 # SKIP
  54. SKIP: all.test 6 # SKIP
  55. XFAIL: all.test 7 # TODO
  56. XFAIL: all.test 8 # TODO
  57. PASS: all.test 9
  58. PASS: all.test 10
  59. PASS: all.test 11
  60. FAIL: all.test 12
  61. SKIP: all.test 13 # SKIP
  62. XFAIL: all.test 14 # TODO
  63. XPASS: all.test 15 # TODO
  64. END
  65. do_checks total=15 pass=5 fail=3 xpass=1 xfail=3 skip=3 error=0
  66. cat > all.test <<END
  67. 1..8
  68. ok 010
  69. not ok 003
  70. ok 0001 # SKIP
  71. not ok 010 # TODO
  72. ok 00100 # TODO
  73. ok 06
  74. ok 00007
  75. ok 8
  76. END
  77. cat > exp <<END
  78. ERROR: all.test 10 # OUT-OF-ORDER (expecting 1)
  79. ERROR: all.test 3 # OUT-OF-ORDER (expecting 2)
  80. ERROR: all.test 1 # OUT-OF-ORDER (expecting 3)
  81. ERROR: all.test 10 # OUT-OF-ORDER (expecting 4)
  82. ERROR: all.test 100 # OUT-OF-ORDER (expecting 5)
  83. PASS: all.test 6
  84. PASS: all.test 7
  85. PASS: all.test 8
  86. END
  87. do_checks total=8 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=5
  88. :