-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
60 lines (56 loc) · 1.77 KB
/
test.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
#!/usr/bin/bash
copy_common () {
cp -RT common $1 # Parameter is the name of the directory (in these cases, test_mattalx)
echo "Files from 'common' transfered"
}
test_liveserver () {
if [[ -e test_mattalx ]]; then
rm -r test_mattalx
fi
echo "Creating 'test_mattalx' directory..."
mkdir test_mattalx
copy_common test_mattalx
cp -RT firefox test_mattalx
cat test_mattalx/popup-specific.js >> test_mattalx/popup.js
rm test_mattalx/popup-specific.js
mv test_mattalx/popup.html test_mattalx/index.html
sed -i '$d' test_mattalx/index.html
sed -i '$d' test_mattalx/index.html
# sed -i '' -e '$ d' test_mattalx/index.html # For Mac users
# sed -i '' -e '$ d' test_mattalx/index.html
cat test/liveserver_test.txt >> test_mattalx/index.html
echo "Directory made"
echo "Opening MatTalX on localhost"
cd test_mattalx
http-server -s -o &
echo "--Done--"
}
test_parser () {
if [[ -e test_mattalx ]]; then
rm -r test_mattalx
fi
echo "Creating 'test_mattalx' directory..."
mkdir test_mattalx
copy_common test_mattalx
echo "Deleting lines associated with html"
sed -i -e '/const settingsFunctions/,/Other/d' test_mattalx/popup.js
sed -i '/^const touchScreen/d' test_mattalx/popup.js
sed -i -e '/const prefersDarkMode/,/Colors/d' test_mattalx/popup.js
sed -i -e '/if (touchScreen)/,/Completion box/d' test_mattalx/popup.js
cat test/parser_test.js >> test_mattalx/popup.js
echo "Directory made"
cd test_mattalx
echo ""
echo "--Start--"
echo ""
node popup.js
echo ""
echo "--Done--"
}
if [[ $1 == "liveserver" ]]; then
test_liveserver
elif [[ $1 == "parser" ]]; then
test_parser
else
echo "Accepted arguments: 'liveserver', 'parser'."
fi