forked from DataTables/DataTablesSrc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unit_tests.sh
executable file
·109 lines (102 loc) · 3.5 KB
/
unit_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
108
109
#!/bin/sh
ENABLE=$1
echo ""
echo " DataTables unit tests"
echo ""
if [ ! "$ENABLE" = "Enable" -a ! "$ENABLE" = "Disable" -o "ENABLE" = "-h" ]; then
echo " Enable or Disable must be given as the first argument."
echo " Optionally the second argument can be given as an integer to enable/disable a certain "
echo " set of tests or the string 'sanity' to run the sanity check for all data types."
echo ""
exit 1
fi
cd ../media/unit_testing
if [ "$ENABLE" = "Enable" ]; then
if [ ! -d tests ]; then
echo " Building test directory"
mkdir tests
mkdir tests/1_dom
mkdir tests/2_js
mkdir tests/3_ajax
mkdir tests/4_server-side
mkdir tests/5_ajax_objects
mkdir tests/6_delayed_rendering
fi
echo " Enabling:"
if [ ! -z $2 ]; then
if [ "$2" = "sanity" ]; then
echo " Sanity checks"
mv tests_onhold/1_dom/_zero_config.js tests/1_dom/
mv tests_onhold/2_js/_zero_config.js tests/2_js/
mv tests_onhold/3_ajax/_zero_config.js tests/3_ajax/
mv tests_onhold/4_server-side/_zero_config.js tests/4_server-side/
mv tests_onhold/5_ajax_objects/_zero_config.js tests/5_ajax_objects/
mv tests_onhold/6_delayed_rendering/_zero_config.js tests/6_delayed_rendering/
elif [ $2 -eq 1 ]; then
echo " DOM"
mv tests_onhold/1_dom/* tests/1_dom/
elif [ $2 -eq 2 ]; then
echo " JS"
mv tests_onhold/2_js/* tests/2_js/
elif [ $2 -eq 3 ]; then
echo " Ajax"
mv tests_onhold/3_ajax/* tests/3_ajax/
elif [ $2 -eq 4 ]; then
echo " SErver-side"
mv tests_onhold/4_server-side/* tests/4_server-side/
elif [ $2 -eq 5 ]; then
echo " Ajax objects"
mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
elif [ $2 -eq 6 ]; then
echo " Delayed rendering"
mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
fi
else
echo " All tests"
mv tests_onhold/1_dom/* tests/1_dom/
mv tests_onhold/2_js/* tests/2_js/
mv tests_onhold/3_ajax/* tests/3_ajax/
mv tests_onhold/4_server-side/* tests/4_server-side/
mv tests_onhold/5_ajax_objects/* tests/5_ajax_objects/
mv tests_onhold/6_delayed_rendering/* tests/6_delayed_rendering/
fi
else
echo " Disabling:"
if [ ! -z $2 ]; then
if [ "$2" = "sanity" ]; then
echo " Sanity checks"
mv tests/1_dom/* tests_onhold/1_dom/
mv tests/2_js/* tests_onhold/2_js/
mv tests/3_ajax/* tests_onhold/3_ajax/
mv tests/4_server-side/* tests_onhold/4_server-side/
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
elif [ $2 -eq 1 ]; then
echo " DOM"
mv tests/1_dom/* tests_onhold/1_dom/
elif [ $2 -eq 2 ]; then
echo " JS"
mv tests/2_js/* tests_onhold/2_js/
elif [ $2 -eq 3 ]; then
echo " Ajax"
mv tests/3_ajax/* tests_onhold/3_ajax/
elif [ $2 -eq 4 ]; then
echo " Server-side"
mv tests/4_server-side/* tests_onhold/4_server-side/
elif [ $2 -eq 5 ]; then
echo " Ajax objects"
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
elif [ $2 -eq 6 ]; then
echo " Delayed rendering"
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
fi
else
echo " All tests"
mv tests/1_dom/* tests_onhold/1_dom/
mv tests/2_js/* tests_onhold/2_js/
mv tests/3_ajax/* tests_onhold/3_ajax/
mv tests/4_server-side/* tests_onhold/4_server-side/
mv tests/5_ajax_objects/* tests_onhold/5_ajax_objects/
mv tests/6_delayed_rendering/* tests_onhold/6_delayed_rendering/
fi
fi