Skip to content

Commit

Permalink
"improved documentation of the scripts"
Browse files Browse the repository at this point in the history
  • Loading branch information
Josee9988 committed Jul 10, 2021
1 parent 0c1d0ee commit 5450c0f
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/FUNCTION_HELPERS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# VERSION: See in CHANGELOG.md
# NOTES: This script will auto remove itself, and in case of wanting to run it again, the user must download
# it again or do a 'git stash' and revert the changes.
# BASH_VERSION: 5.0.17(1)-release
# BASH_VERSION: 5.1.4(1)-release (x86_64-pc-linux-gnu)
# LICENSE: see in ../LICENSE (project root) or https://github.com/Josee9988/project-template/blob/master/LICENSE
# GITHUB: https://github.com/Josee9988/
# REPOSITORY: https://github.com/Josee9988/project-template
Expand Down
27 changes: 22 additions & 5 deletions tests/TESTS_RUNNER.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,36 @@
#!/bin/bash

#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#
# PURPOSE: Main test script that will call all the individual unitary tests.
# TITLE: TESTS_RUNNER
# AUTHOR: Jose Gracia
# VERSION: See in CHANGELOG.md
# NOTES: This script does not contain any test, it only calls all the tests one by one.
# BASH_VERSION: 5.1.4(1)-release (x86_64-pc-linux-gnu)
# LICENSE: see in ../LICENSE (project root) or https://github.com/Josee9988/project-template/blob/master/LICENSE
# GITHUB: https://github.com/Josee9988/
# REPOSITORY: https://github.com/Josee9988/project-template
# ISSUES: https://github.com/Josee9988/project-template/issues
# MAIL: [email protected]
#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#

LGREEN='\033[0;32m'
NC='\033[0m' # No Color
TESTS_TRASH_DIR="tests/.ignore.tests_trash/"
declare -a files=("tests/project_scaffolding_test.sh" "tests/custom_data_test.sh") # all the tests
declare -a test_files=("tests/project_scaffolding_test.sh" "tests/custom_data_test.sh") # all the tests

center() {
term_width="$(tput cols)"
padding="$(printf '%0.1s' +{1..500})"
echo -e "\n${LGREEN}$(printf '%*.*s %s %*.*s\n' 0 "$(((term_width - 2 - ${#1}) / 2))" "$padding" "$1" 0 "$(((term_width - 1 - ${#1}) / 2))" "$padding")${NC}"
}

for file in "${files[@]}"; do
mkdir -p tests/.ignore.tests_trash
rm -r $TESTS_TRASH_DIR 2>/dev/null || : # remove any possible old test run trash files

# run all the tests
for file in "${test_files[@]}"; do
mkdir -p tests/.ignore.tests_trash # create the files where the tests will attack upon
center "TEST: running test ./$file"
./"$file"
rm -r $TESTS_TRASH_DIR
./"$file" # run the test
rm -r $TESTS_TRASH_DIR # remove the previously created files
done
16 changes: 15 additions & 1 deletion tests/custom_data_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#! /bin/bash
# file: examples/custom_data_test.sh

#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#
# PURPOSE: Test suite for testing the modified custom data, after executing the SETUP_TEMPLATE script.º
# TITLE: Custom Data tests
# AUTHOR: Jose Gracia
# VERSION: See in CHANGELOG.md
# NOTES: This script is called by the TESTS_RUNNER.sh script. And it unit tests all the custom data modified
# by the SETUP_TEMPLATE script.
# BASH_VERSION: 5.1.4(1)-release (x86_64-pc-linux-gnu)
# LICENSE: see in ../LICENSE (project root) or https://github.com/Josee9988/project-template/blob/master/LICENSE
# GITHUB: https://github.com/Josee9988/
# REPOSITORY: https://github.com/Josee9988/project-template
# ISSUES: https://github.com/Josee9988/project-template/issues
# MAIL: [email protected]
#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#

TESTS_TRASH_DIR="tests/.ignore.tests_trash"
USERNAME="FAKE_USERNAME_TESTS"
Expand Down
16 changes: 15 additions & 1 deletion tests/project_scaffolding_test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#! /bin/bash
# file: examples/project_scaffolding_test.sh

#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#
# PURPOSE: Test suite for testing the proejct scaffolding after executing the SETUP_TEMPLATE script.
# TITLE: Project Scaffolding tests
# AUTHOR: Jose Gracia
# VERSION: See in CHANGELOG.md
# NOTES: This script is called by the TESTS_RUNNER.sh script. And it unit tests the newly generated scaffolding
# generated by the SETUP_TEMPLATE script.
# BASH_VERSION: 5.1.4(1)-release (x86_64-pc-linux-gnu)
# LICENSE: see in ../LICENSE (project root) or https://github.com/Josee9988/project-template/blob/master/LICENSE
# GITHUB: https://github.com/Josee9988/
# REPOSITORY: https://github.com/Josee9988/project-template
# ISSUES: https://github.com/Josee9988/project-template/issues
# MAIL: [email protected]
#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#~#

TESTS_TRASH_DIR="tests/.ignore.tests_trash"
USERNAME="FAKE_USERNAME_TESTS"
Expand Down

0 comments on commit 5450c0f

Please sign in to comment.