1 |
#!/bin/sh |
#!/bin/sh |
2 |
# javascript.sh - test various JavaScript constructs |
# javascript.sh - test various JavaScript constructs |
3 |
# Copyright (C) 2007 siliconforks.com |
# Copyright (C) 2007, 2008, 2009 siliconforks.com |
4 |
# |
# |
5 |
# This program is free software; you can redistribute it and/or modify |
# 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 |
# it under the terms of the GNU General Public License as published by |
22 |
|
|
23 |
export PATH=.:..:$PATH |
export PATH=.:..:$PATH |
24 |
|
|
25 |
|
if jscoverage-server --version | grep -q 'iconv\|MultiByteToWideChar' |
26 |
|
then |
27 |
|
character_encoding_support=yes |
28 |
|
else |
29 |
|
character_encoding_support=no |
30 |
|
fi |
31 |
|
|
32 |
rm -fr DIR |
rm -fr DIR |
33 |
$VALGRIND jscoverage javascript DIR |
case "$character_encoding_support" in |
34 |
for i in javascript/*.expected.js |
yes) |
35 |
|
$VALGRIND jscoverage --js-version 180 --encoding ISO-8859-1 javascript DIR |
36 |
|
;; |
37 |
|
*) |
38 |
|
$VALGRIND jscoverage --js-version=180 --exclude=javascript-iso-8859-1.js javascript DIR |
39 |
|
;; |
40 |
|
esac |
41 |
|
for i in javascript/*.js |
42 |
do |
do |
43 |
EXPECTED=$i |
if [ $character_encoding_support = no -a $i = javascript/javascript-iso-8859-1.js ] |
44 |
ACTUAL=$EXPECTED |
then |
45 |
ACTUAL=${ACTUAL%%.expected.js} |
continue |
46 |
ACTUAL=${ACTUAL##javascript/} |
fi |
47 |
ACTUAL=DIR/${ACTUAL}.js |
FILE=${i##javascript/} |
48 |
|
EXPECTED=javascript.expected/${FILE} |
49 |
|
ACTUAL=DIR/${FILE} |
50 |
diff -u -r --strip-trailing-cr $EXPECTED $ACTUAL |
diff -u -r --strip-trailing-cr $EXPECTED $ACTUAL |
51 |
done |
done |
52 |
|
|