Skip to content

Commit eba4f9e

Browse files
committed
Improve test script to test all js files in sample directory
1 parent 159e8d3 commit eba4f9e

File tree

1 file changed

+8
-27
lines changed

1 file changed

+8
-27
lines changed

test.sh

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
echo "mini-javascript test script"
3-
echo
43

54
BINARY=./javascript
65
if [ ! -f $BINARY ]; then
@@ -9,29 +8,11 @@ if [ ! -f $BINARY ]; then
98
exit
109
fi
1110

12-
echo "Test variable declaration"
13-
$BINARY samples/variable.js
14-
15-
echo
16-
echo "Test condition statements"
17-
$BINARY samples/condition.js
18-
19-
echo
20-
echo "Test iteration stastements"
21-
$BINARY samples/iteration.js
22-
23-
echo
24-
echo "Test unary expressions"
25-
$BINARY samples/unary.js
26-
27-
echo
28-
echo "Test strict mode"
29-
$BINARY samples/use_strict.js
30-
31-
echo
32-
echo "Test error file"
33-
$BINARY samples/err.js
34-
35-
echo
36-
echo "Test simple javascript source"
37-
$BINARY samples/simple.js
11+
SAMPLE_DIR=./samples
12+
for SRC in "$SAMPLE_DIR"/*.js
13+
do
14+
if [ -f $SRC ]; then
15+
echo -e "\nTest $SRC"
16+
$BINARY $SRC
17+
fi
18+
done

0 commit comments

Comments
 (0)