-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtests.sh
More file actions
53 lines (42 loc) · 943 Bytes
/
tests.sh
File metadata and controls
53 lines (42 loc) · 943 Bytes
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
cc=$(pwd)/codechallenger
cc_dir_path=../codechallenger-cli-tests
fancy_echo(){
printf "\033[1;%sm%s\033[0m\n" "$1" "$2"
}
test_cmd_pass(){
yes | $cc "$@" --path=$cc_dir_path
if [ $? -ne 0 ]; then
clean_up
exit 1
else
fancy_echo 32 "Pass: $1 [OK]"
fi
}
test_cmd_fail(){
yes | $cc "$@" --path=$cc_dir_path
if [ $? -ne 1 ]; then
clean_up
exit 1
else
fancy_echo 32 "Fail: $1 [OK]"
fi
}
clean_up(){
rm -rf $cc_dir_path
}
# create folder to run tests in
mkdir $cc_dir_path
cd $cc_dir_path
# add settings to gitignore
# to prevent git conflicts when pulling/pushing
echo ".codechallenger.json" >> .gitignore
# run tests
test_cmd_pass init
test_cmd_pass deploy -m "unit test commit" -p --repository "https://github.com/CodeChallenger/CodeChallenger-CLI-test-repo.git" --istest
test_cmd_pass uninit
test_cmd_fail deploy
test_cmd_fail uninit
fancy_echo 32 "
✔ Yeey! You passed all tests!"
clean_up
exit 0