tap-number-wordboundary.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. # - TAP result numbers terminated by a non-whitespace "word boundary"
  18. # character are recognized
  19. . test-init.sh
  20. . tap-setup.sh
  21. cat > all.test <<'END'
  22. 1..5
  23. ok 1: foo1
  24. not ok 2- foo2
  25. ok 3@ foo3 # SKIP
  26. not ok 4?&%$ foo4 # TODO
  27. ok 5"`!! foo5 # TODO
  28. END
  29. run_make -O -e FAIL check
  30. count_test_results total=5 pass=1 fail=1 skip=1 xpass=1 xfail=1 error=0
  31. $EGREP '^PASS: all\.test 1 ?: foo1$' stdout
  32. $EGREP '^FAIL: all\.test 2 ?- foo2$' stdout
  33. $EGREP '^SKIP: all\.test 3 ?@ foo3 # SKIP$' stdout
  34. $EGREP '^XFAIL: all\.test 4 ?\?&%\$ foo4 # TODO$' stdout
  35. $EGREP '^XPASS: all\.test 5 ?"`!! foo5 # TODO$' stdout
  36. cat > all.test <<'END'
  37. 1..3
  38. ok 2: quux
  39. not ok 1!
  40. ok 476$ # SKIP
  41. END
  42. run_make -O -e FAIL check
  43. count_test_results total=3 pass=0 fail=0 skip=0 xpass=0 xfail=0 error=3
  44. $EGREP '^ERROR: all\.test 2 ?: quux # OUT-OF-ORDER \(expecting 1\)$' stdout
  45. $EGREP '^ERROR: all\.test 1 ?! # OUT-OF-ORDER \(expecting 2\)$' stdout
  46. $EGREP '^ERROR: all\.test 476 ?\$ # OUT-OF-ORDER \(expecting 3\)$' stdout
  47. cat > punctuation <<'END'
  48. '
  49. "
  50. `
  51. #
  52. $
  53. !
  54. \
  55. /
  56. &
  57. %
  58. (
  59. )
  60. |
  61. ^
  62. ~
  63. ?
  64. *
  65. +
  66. -
  67. ,
  68. :
  69. ;
  70. =
  71. <
  72. >
  73. @
  74. [
  75. ]
  76. {
  77. }
  78. \
  79. END
  80. # Strip any extra whitespace, for Solaris' wc.
  81. planned=$(wc -l <punctuation | tr -d " $tab")
  82. echo 1..$planned > all.test
  83. awk '{print "ok " NR $0 }' punctuation >> all.test
  84. # For debugging.
  85. cat all.test
  86. # Sanity check.
  87. grep "^ok 1'$" all.test || framework_failure_ "creating all.test"
  88. run_make -O check
  89. count_test_results total=$planned pass=$planned \
  90. fail=0 skip=0 xpass=0 xfail=0 error=0
  91. :