-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecute_tests.sh
executable file
·74 lines (55 loc) · 1.59 KB
/
execute_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
#!/bin/bash
source tests/resources/utils.sh
TEMPLATES_DIR="$HOME/.mkt-dev";
TEST_DIR="tests/";
DIR_TEMPLATE_TEST="test_dir_template.sh";
GIT_TEMPLATE_TEST="test_git_template.sh";
TXML_TEMPLATE_TEST="test_txml_template.sh";
BINARY_APP="mkt_dev";
RESOURCES_DIR="resources";
reset_app_dir()
{
rm -rf "$TEMPLATES_DIR";
for archivo in ./* ./.*; do
if [[ "$archivo" == "./." || "$archivo" == "./.." || \
"$archivo" == "./$DIR_TEMPLATE_TEST" || \
"$archivo" == "./$GIT_TEMPLATE_TEST" || \
"$archivo" == "./$TXML_TEMPLATE_TEST" || \
"$archivo" == "./$BINARY_APP" || \
"$archivo" == "./$RESOURCES_DIR" ]]; then
continue # Don't remove files needed for testing
fi
rm -rf "$archivo";
done
}
if [ ! -d "$TEST_DIR" ]; then
printf "tests dir does not exist"
exit 1;
fi
# cargo test
cargo test
cargo build -p bin_app
cp "target/debug/bin_app" "tests/$BINARY_APP"
cd tests || exit
### Execute Dir Template test
if ! bash "$DIR_TEMPLATE_TEST"; then
echo -e "=> ${FAILED}: Directory templates didn't pass the tests"
else
echo -e "=> ${SUCCESS}: Directory templates passed the tests"
fi
reset_app_dir;
### Execute Git Template test
if ! bash "$GIT_TEMPLATE_TEST"; then
echo -e "=> ${FAILED}: Git templates didn't pass the tests"
else
echo -e "=> ${SUCCESS}: Git templates passed the tests"
fi
reset_app_dir;
### Execute TXML Template test
if ! bash "$TXML_TEMPLATE_TEST"; then
echo -e "=> ${FAILED}: TXML templates didn't pass the tests"
else
echo -e "=> ${SUCCESS}: TXML templates passed the tests"
fi
reset_app_dir;
rm "$BINARY_APP"