PageRenderTime 18ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/tests/fatal.sh

http://github.com/onedayitwillmake/RealtimeMultiplayerNodeJs
Shell | 110 lines | 63 code | 21 blank | 26 comment | 12 complexity | 00b9ff7147280a64ea4dce9cc420b607 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. #!/bin/sh
  2. # fatal.sh - test various fatal errors
  3. # Copyright (C) 2007, 2008 siliconforks.com
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. set -e
  19. trap 'rm -fr DIR DIR2 OUT ERR' 1 2 3 15
  20. export PATH=.:..:$PATH
  21. rm -fr DIR DIR2
  22. $VALGRIND jscoverage javascript-xml DIR > OUT 2> ERR && exit 1
  23. test ! -s OUT
  24. test -s ERR
  25. diff --strip-trailing-cr javascript-xml.expected.err ERR
  26. rm -fr DIR
  27. $VALGRIND jscoverage javascript-invalid DIR > OUT 2> ERR && exit 1
  28. test ! -s OUT
  29. test -s ERR
  30. diff --strip-trailing-cr javascript-invalid.expected.err ERR
  31. rm -fr DIR
  32. $VALGRIND jscoverage javascript-setter DIR > OUT 2> ERR && exit 1
  33. test ! -s OUT
  34. test -s ERR
  35. diff --strip-trailing-cr javascript-setter.expected.err ERR
  36. rm -fr DIR
  37. $VALGRIND jscoverage 1 2 3 > OUT 2> ERR && exit 1
  38. test ! -s OUT
  39. test -s ERR
  40. diff --strip-trailing-cr too-many-arguments.expected.err ERR
  41. rm -fr DIR
  42. $VALGRIND jscoverage --no-instrument > OUT 2> ERR && exit 1
  43. test ! -s OUT
  44. test -s ERR
  45. diff --strip-trailing-cr no-instrument-requires-argument.expected.err ERR
  46. $VALGRIND jscoverage --exclude > OUT 2> ERR && exit 1
  47. test ! -s OUT
  48. test -s ERR
  49. diff --strip-trailing-cr exclude-requires-argument.expected.err ERR
  50. $VALGRIND jscoverage --encoding > OUT 2> ERR && exit 1
  51. test ! -s OUT
  52. test -s ERR
  53. diff --strip-trailing-cr encoding-requires-argument.expected.err ERR
  54. # first arg does not exist
  55. rm -f foo
  56. $VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1
  57. test ! -s OUT
  58. test -s ERR
  59. # diff --strip-trailing-cr source-does-not-exist.expected.err ERR
  60. # first arg is file
  61. touch foo
  62. $VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1
  63. test ! -s OUT
  64. test -s ERR
  65. # diff --strip-trailing-cr source-is-file.expected.err ERR
  66. rm foo
  67. # second arg is file
  68. rm -fr bar
  69. touch bar
  70. $VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1
  71. test ! -s OUT
  72. test -s ERR
  73. # diff --strip-trailing-cr destination-is-file.expected.err ERR
  74. rm bar
  75. # second arg is directory, but not from previous run
  76. rm -fr bar
  77. mkdir bar
  78. touch bar/foo
  79. $VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1
  80. test ! -s OUT
  81. test -s ERR
  82. # diff --strip-trailing-cr destination-is-existing-directory.expected.err ERR
  83. rm -fr bar
  84. # huge JavaScript file
  85. mkdir -p DIR
  86. perl -e 'for (1 .. 65536) {print "x = $_\n";}' > DIR/big.js
  87. $VALGRIND jscoverage DIR DIR2 > OUT 2> ERR && exit 1
  88. echo 'jscoverage: file big.js contains more than 65,535 lines' | diff --strip-trailing-cr - ERR
  89. rm -fr DIR DIR2 OUT ERR