-
Notifications
You must be signed in to change notification settings - Fork 16
/
tests.sh
executable file
·107 lines (87 loc) · 2.12 KB
/
tests.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash -e
TEST_FILE=/tmp/py-test-file.py
install_emacs24() {
sudo add-apt-repository ppa:cassou/emacs -y
sudo apt-get update -y
sudo apt-get install emacs24 -y
}
test_01() {
echo $FUNCNAME
rm $TEST_FILE || true
emacs --no-init-file -nw \
--load ./tests/tests.el \
--load py-isort.el \
./tests/01/before.py \
-f py-isort-before-save \
-f write-test-file \
-f kill-emacs
diff $TEST_FILE ./tests/01/after.py
}
test_02() {
echo $FUNCNAME
rm $TEST_FILE || true
emacs --no-init-file -nw \
--load ./tests/tests.el \
--load py-isort.el \
./tests/02/before.py \
-f py-isort-before-save \
-f write-test-file \
-f kill-emacs
diff $TEST_FILE ./tests/02/after.py
}
test_03() {
echo $FUNCNAME
rm $TEST_FILE || true
emacs --no-init-file -nw \
--load ./tests/tests.el \
--load py-isort.el \
./tests/03/before.py \
-f mark-whole-buffer \
-f py-isort-region \
-f write-test-file \
-f kill-emacs
diff $TEST_FILE ./tests/03/after.py
}
test_04() {
echo $FUNCNAME
rm $TEST_FILE || true
emacs --no-init-file -nw \
--load ./tests/tests.el \
--load py-isort.el \
./tests/04/before.py \
-f py-isort-buffer \
-f write-test-file \
-f kill-emacs
diff $TEST_FILE ./tests/04/after.py
}
test_05() {
echo $FUNCNAME
rm $TEST_FILE || true
emacs --no-init-file -nw \
--load ./tests/tests.el \
--load py-isort.el \
./tests/05/files/before.py \
-f py-isort-buffer \
-f write-test-file \
-f kill-emacs
diff $TEST_FILE ./tests/05/files/after.py
}
test_install_package() {
echo $FUNCNAME
emacs --no-init-file -nw \
py-isort.el \
-f package-install-from-buffer \
-f kill-emacs
}
main() {
if [ "$TRAVIS" = "true" ]; then
install_emacs24
test_install_package
fi
test_01
test_02
test_03
test_04
test_05
}
main