Skip to content

Commit aeba6ce

Browse files
committed
commonjs test - now fails tests which throw uncaught exceptions
1 parent 1f73810 commit aeba6ce

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/js/commonjs-modules.bash

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,40 @@ cd `dirname "$0"`/../commonjs-official/tests/modules/1.0 || panic "could not cha
1515

1616
runTest()
1717
{
18+
testName="`printf '%20s' \"$1\"`"
19+
set -o pipefail
20+
echo -n "${testName}: "
21+
1822
PMJS_PATH="`pwd`" ../../../../../../pmjs -e 'print=python.print' program.js\
1923
| while read word rest
2024
do
2125
case "$word" in
22-
"PASS")
23-
echo "$word $rest"
26+
"PASS"|"DONE")
27+
echo -n "$word $rest"
2428
return 0
2529
;;
2630
"FAIL")
27-
echo "$word $rest" >&2
31+
echo -n "\r${testName}: $word $rest" >&2
2832
return 1
2933
;;
3034
*)
3135
echo "$word $rest"
36+
echo -n "${testName}: "
3237
;;
3338
esac
39+
(exit 2)
3440
done
41+
ret="$?"
42+
echo
43+
return "$ret"
3544
}
3645

3746
find . -name program.js \
3847
| while read program
3948
do
4049
testDir=`dirname "${program}"`
4150
cd "${testDir}"
42-
runTest || failures=$[${failures:-0} + 1]
51+
runTest "`basename ${testDir}`" || failures=$[${failures:-0} + 1]
4352
cd ..
4453
(exit ${failures-0})
4554
done

0 commit comments

Comments
 (0)