This repository was archived by the owner on Oct 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·67 lines (60 loc) · 1.44 KB
/
test.sh
File metadata and controls
executable file
·67 lines (60 loc) · 1.44 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
bad=fixtures/bad.clj
good=fixtures/good.clj
untrimmed=fixtures/untrimmed.clj
temp=fixtures/temp.clj
actual=fixtures/actual.clj
# default
node parlinter.js $bad > $temp
restore() {
rm $temp
}
if ! diff $temp $untrimmed > /dev/null; then
echo "Test Failed for --write : expected $bad to be corrected to match $untrimmed."
echo "Check $actual for actual output."
cp $temp $actual
restore
exit 1
fi
restore
# --write
cp $bad $temp
node parlinter.js --write $bad > /dev/null
restore() {
cp $temp $bad
rm $temp
}
if ! diff $bad $untrimmed > /dev/null; then
echo "Test Failed for --write : expected $bad to be corrected to match $good."
echo "Check $actual for actual output."
cp $bad $actual
restore
exit 1
fi
restore
# --trim
node parlinter.js --trim $bad > $temp
restore() {
rm $temp
}
if ! diff $temp $good > /dev/null; then
echo "Test Failed for --trim : expected $bad to trim down to $good."
echo "Check $actual for actual output."
cp $temp $actual
restore
exit 1
fi
restore
# --list different
if node parlinter.js -l $bad > /dev/null; then
echo "Test Failed for --list-different : expected $bad to be listed"
exit 1
fi
if ! node parlinter.js -l $good > /dev/null; then
echo "Test Failed for --list-different : expected $good to not be listed"
exit 1
fi
if ! node parlinter.js -l $untrimmed > /dev/null; then
echo "Test Failed for --list-different : expected $untrimmed to not be listed"
exit 1
fi
echo "TESTS PASSED."