-
Notifications
You must be signed in to change notification settings - Fork 0
/
testing.sh
executable file
·294 lines (239 loc) · 10.3 KB
/
testing.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
#counter of test cases
number=1
# Colors
Color_Off='\033[0m'
IBlue='\033[0;94m'
IYellow='\033[0;93m'
IRed='\033[0;91m'
# Test cases
TS_help_text="./test/case#1"
EXP2="./test/case#2"
EXP3="./test/case#3"
EXP4="./test/case#4"
EXP5="./test/case#5"
EXP6="./test/case#6"
EXP7="./test/case#7"
EXP8="./test/case#8"
EXP9="./test/case#9"
EXP10="./test/case#10"
EXP11="./test/case#11"
EXP12="./test/case#12"
EXP13="./test/case#13"
EXPsectionDoesntExist="./test/case#SectionDoesntExist"
EXP16="./test/case#16"
EXPsectionTextDoesntExist="./test/case#sectionTextDoesntExist"
TS_print_section="./test/case#print_section"
TS_print_section_line=."/test/case#print_section_line"
echo -e "\n${IRed}Testing local owo${Color_Off}\n"
#Before start
./owo clean
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print help text)${Color_Off}"
diff -u -s $TS_help_text <(./owo help)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (initialize document.txt))${Color_Off}"
./owo init
diff -u -s $EXP2 <(ls)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (clean document.txt)${Color_Off}"
./owo clean
diff -u -s $EXP3 <(ls)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (initialize owo again)${Color_Off}"
./owo init
diff -u -s $EXP4 <(./owo init)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add section)${Color_Off}"
./owo add first
diff -s document.txt $EXP5
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add more sections)${Color_Off}"
./owo add second
./owo add third
./owo add fourth
diff -s document.txt $EXP6
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add text to section by id)${Color_Off}"
./owo add 2 "ahoj"
diff -s document.txt $EXP7
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add text to section by name)${Color_Off}"
./owo add first "dalsi text na test"
diff -s document.txt $EXP8
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add more texts to section)${Color_Off}"
./owo add second "run all tests"
./owo add second "NO duplicates"
./owo add 1 "express programer means good names atd"
./owo add 1 "minimalize classes, methods, functions"
./owo add 3 "tesssssss"
./owo add fourth "lalalal"
diff -s document.txt $EXP9
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print sections)${Color_Off}"
diff -u -s $EXP10 <(./owo print --sections)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section by id)${Color_Off}"
diff -u -s $TS_print_section <(./owo print 1)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section by name)${Color_Off}"
diff -u -s $TS_print_section <(./owo p second)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section line by id)${Color_Off}"
diff -u -s $TS_print_section_line <(./owo print 1 2)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section line by name)${Color_Off}"
diff -u -s $TS_print_section_line <(./owo p second 2)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (same section name)${Color_Off}"
diff -u -s $EXP11 <(./owo add second)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by id)${Color_Off}"
./owo delete 0
diff -s document.txt $EXP12
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by name)${Color_Off}"
./owo delete third
diff -s document.txt $EXP13
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by id)${Color_Off}"
diff -s $EXPsectionDoesntExist <(./owo delete 4)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by name)${Color_Off}"
diff -s $EXPsectionDoesntExist <(./owo delete third)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
./owo d 1 0
diff -s document.txt $EXP16
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
diff -s $EXPsectionTextDoesntExist <(./owo d 1 3)
((number++))
echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
./owo d 1 0
diff -s $EXPsectionTextDoesntExist <(./owo delete 1 0)
((number++))
# echo -e "\n${IRed}Testing global owo${Color_Off}\n"
#Before start
# owo clean
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print help text)${Color_Off}"
# diff -u -s $TS_help_text <(owo help)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (initialize document.txt))${Color_Off}"
# owo init
# diff -u -s $EXP2 <(ls)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (clean document.txt)${Color_Off}"
# owo clean
# diff -u -s $EXP3 <(ls)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (initialize owo again)${Color_Off}"
# owo init
# diff -u -s $EXP4 <(owo init)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add section)${Color_Off}"
# owo add first
# diff -s document.txt $EXP5
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add more sections)${Color_Off}"
# owo add second
# owo add third
# owo add fourth
# diff -s document.txt $EXP6
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add text to section by id)${Color_Off}"
# owo add 2 "ahoj"
# diff -s document.txt $EXP7
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add text to section by name)${Color_Off}"
# owo add first "dalsi text na test"
# diff -s document.txt $EXP8
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (add more texts to section)${Color_Off}"
# owo add second "run all tests"
# owo add second "NO duplicates"
# owo add 1 "express programer means good names atd"
# owo add 1 "minimalize classes, methods, functions"
# owo add 3 "tesssssss"
# owo add fourth "lalalal"
# diff -s document.txt $EXP9
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print sections)${Color_Off}"
# diff -u -s $EXP10 <(owo print --sections)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section by id)${Color_Off}"
# diff -u -s $TS_print_section <(owo print 1)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section by name)${Color_Off}"
# diff -u -s $TS_print_section <(owo p second)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section line by id)${Color_Off}"
# diff -u -s $TS_print_section_line <(owo print 1 2)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (print section line by name)${Color_Off}"
# diff -u -s $TS_print_section_line <(owo p second 2)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (same section name)${Color_Off}"
# diff -u -s $EXP11 <(owo add second)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by id)${Color_Off}"
# owo delete 0
# diff -s document.txt $EXP12
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by name)${Color_Off}"
# owo delete third
# diff -s document.txt $EXP13
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by id)${Color_Off}"
# diff -s $EXPsectionDoesntExist <(owo delete 4)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section by name)${Color_Off}"
# diff -s $EXPsectionDoesntExist <(owo delete third)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
# owo d 1 0
# diff -s document.txt $EXP16
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
# diff -s $EXPsectionTextDoesntExist <(owo d 1 3)
# ((number++))
# echo -e "${IYellow}\tCase ${IBlue}#$number${IYellow} (delete section text)${Color_Off}"
# owo d 1 0
# diff -s $EXPsectionTextDoesntExist <(owo delete 1 0)
# ((number++))
# #clear document.txt
# ./owo delete 1
./owo add git
./owo add git "git init - initialize repository"
./owo add git "git status - check state of the project"
./owo add git "git add <files> - add files to git for tracking"
./owo add git "git commit -m <comment> - commit files"
./owo add git "git log - history of commits"
./owo add git "git diff - differences between 2 files"
./owo add git "git checkout -- <file> - restore file from last commit"
./owo add git "git checkout <hash> - restore that commit"
./owo add git "git checkout <branch> - restore last commit"
./owo add git "git undo last commit - delete last commit"
./owo add git "git clone <url> <folder> - clone repository to folder from remote server"
./owo add git "git remote add origin <url> - create connection with remote repository"
./owo add git "git push -u origin <branch> - push first commit to remote repository (next commits without -u)"
./owo add git "git pull origin <branch> - download changes from remote repository with merge"
./owo add git "git fetch - download changes from remote repository without merge"
./owo add git "git remote update - get commits update from remote repository"
./owo add git "git whatchanged origin/master -n 1 - what changed on remote repository"
./owo add git "git branch - shows all branches in this program"
./owo add git "git branch <name> - create new branch with name"
./owo add git "git checkout <branch> - switch branch"
./owo add git "git switch <branch> - ---||---"
./owo add git "git merge <branch> - copy branch to master"
./owo add git "git rebase <branch> - copy branch to master and destroy this branch"
./owo add git "git mergetool - tool for solving conflicts"
./owo add markdown
./owo add markdown "altGR + h == `` "
./owo add npm
./owo add npm "npm init - init repository"
./owo add npm "npm search - search for package"
./owo add npm "npm install - install package"
./owo add npm "npm outdated - show versions of packages"
./owo add npm "npm update <package> - update version of package"
./owo add phpmyadmin
./owo add phpmyadmin "user: zak, password: 1234"