/js/lib/Socket.IO-node/support/expresso/deps/jscoverage/tests/fatal.sh
Shell | 110 lines | 63 code | 21 blank | 26 comment | 12 complexity | 00b9ff7147280a64ea4dce9cc420b607 MD5 | raw file
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 19set -e 20 21trap 'rm -fr DIR DIR2 OUT ERR' 1 2 3 15 22 23export PATH=.:..:$PATH 24 25rm -fr DIR DIR2 26 27$VALGRIND jscoverage javascript-xml DIR > OUT 2> ERR && exit 1 28test ! -s OUT 29test -s ERR 30diff --strip-trailing-cr javascript-xml.expected.err ERR 31 32rm -fr DIR 33 34$VALGRIND jscoverage javascript-invalid DIR > OUT 2> ERR && exit 1 35test ! -s OUT 36test -s ERR 37diff --strip-trailing-cr javascript-invalid.expected.err ERR 38 39rm -fr DIR 40 41$VALGRIND jscoverage javascript-setter DIR > OUT 2> ERR && exit 1 42test ! -s OUT 43test -s ERR 44diff --strip-trailing-cr javascript-setter.expected.err ERR 45 46rm -fr DIR 47 48$VALGRIND jscoverage 1 2 3 > OUT 2> ERR && exit 1 49test ! -s OUT 50test -s ERR 51diff --strip-trailing-cr too-many-arguments.expected.err ERR 52 53rm -fr DIR 54 55$VALGRIND jscoverage --no-instrument > OUT 2> ERR && exit 1 56test ! -s OUT 57test -s ERR 58diff --strip-trailing-cr no-instrument-requires-argument.expected.err ERR 59 60$VALGRIND jscoverage --exclude > OUT 2> ERR && exit 1 61test ! -s OUT 62test -s ERR 63diff --strip-trailing-cr exclude-requires-argument.expected.err ERR 64 65$VALGRIND jscoverage --encoding > OUT 2> ERR && exit 1 66test ! -s OUT 67test -s ERR 68diff --strip-trailing-cr encoding-requires-argument.expected.err ERR 69 70# first arg does not exist 71rm -f foo 72$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 73test ! -s OUT 74test -s ERR 75# diff --strip-trailing-cr source-does-not-exist.expected.err ERR 76 77# first arg is file 78touch foo 79$VALGRIND jscoverage foo bar > OUT 2> ERR && exit 1 80test ! -s OUT 81test -s ERR 82# diff --strip-trailing-cr source-is-file.expected.err ERR 83rm foo 84 85# second arg is file 86rm -fr bar 87touch bar 88$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 89test ! -s OUT 90test -s ERR 91# diff --strip-trailing-cr destination-is-file.expected.err ERR 92rm bar 93 94# second arg is directory, but not from previous run 95rm -fr bar 96mkdir bar 97touch bar/foo 98$VALGRIND jscoverage javascript bar > OUT 2> ERR && exit 1 99test ! -s OUT 100test -s ERR 101# diff --strip-trailing-cr destination-is-existing-directory.expected.err ERR 102rm -fr bar 103 104# huge JavaScript file 105mkdir -p DIR 106perl -e 'for (1 .. 65536) {print "x = $_\n";}' > DIR/big.js 107$VALGRIND jscoverage DIR DIR2 > OUT 2> ERR && exit 1 108echo 'jscoverage: file big.js contains more than 65,535 lines' | diff --strip-trailing-cr - ERR 109 110rm -fr DIR DIR2 OUT ERR