-
Notifications
You must be signed in to change notification settings - Fork 18
/
casetest
executable file
·43 lines (40 loc) · 1.04 KB
/
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
40
41
42
43
#!/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 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
python $1 > 1.pyres
./pyjs.py -q --builtins=import-each -o 1.js $1
if run 1.js > 1.jsres; then
if diff -au 1.pyres 1.jsres; then
echo "------------------------------------------"
cat 1.jsres
echo "------------------------------------------"
echo "Files match"
fi
else
echo "Could not run $1:"
cat 1.jsres
fi
read "dummy?Press enter to continue>"
echo
echo "################################################################################"
echo
done