forked from chrivers/pyjaco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
casetest
executable file
·39 lines (36 loc) · 879 Bytes
/
casetest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/zsh -f
if [[ $1 == "" ]]; then
echo "Usage: $0 <testname>"
exit 1
fi
if [[ -x $(which js) ]]; then
function run() {
$(which js) $1
}
elif [[ -x $(which cscript) ]]; then
function run() {
$(which cscript) //NoLogo //U $1 | iconv -f UTF-16LE -t UTF-8 | sed -re 's|\x0A\n|\n|'
}
else
echo "Could not find a javascript interpreter"
exit 1
fi
while true; do
touch $1
./pyjs.py -b generate -o .
python $1 > 1.res
./pyjs.py -q --builtins=import -o 1.js $1
if run 1.js > 1.out; then
if diff -au 1.res 1.out; then
echo "Files now match!"
exit
fi
else
echo "Could not run $1:"
cat 1.out
fi
read "dummy?Press enter to continue>"
echo
echo "################################################################################"
echo
done