test.sh: rename functions

client-spec/clarity
Marco Bonelli 2019-11-27 18:22:38 +01:00 committed by Waldir Pimenta
parent 9b4decb926
commit 4d153b7d8e
1 changed files with 10 additions and 10 deletions

View File

@ -8,16 +8,16 @@
# NOTE: must be run from the repository root directory to correctly work! # NOTE: must be run from the repository root directory to correctly work!
# NOTE: `set -e` is applied conditionally only if needed. # NOTE: `set -e` is applied conditionally only if needed.
# Default test. # Default test function, ran by `npm test`.
function default_test { function run_tests {
markdownlint pages*/**/*.md markdownlint pages*/**/*.md
tldr-lint ./pages tldr-lint ./pages
} }
# Special test for Travis CI pull request builds. # Special test function for Travis CI pull request builds.
# Runs default_test collecting errors for tldr-bot. # Runs run_tests collecting errors for tldr-bot.
function pr_test { function run_tests_pr {
errs=`default_test 2>&1` errs=`run_tests 2>&1`
if [ -n "$errs" ]; then if [ -n "$errs" ]; then
echo -e "Test failed!\n$errs\n" >&2 echo -e "Test failed!\n$errs\n" >&2
@ -29,7 +29,7 @@ function pr_test {
# Additional checks for Travis CI pull request builds. # Additional checks for Travis CI pull request builds.
# Only taken as suggestions, does not make the build fail. # Only taken as suggestions, does not make the build fail.
function pr_check { function run_checks_pr {
msgs=`bash scripts/check-pr.sh` msgs=`bash scripts/check-pr.sh`
if [ -n "$msgs" ]; then if [ -n "$msgs" ]; then
@ -44,11 +44,11 @@ function pr_check {
################################### ###################################
if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_REPO_SLUG" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_REPO_SLUG" = "tldr-pages/tldr" ] && [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
pr_check run_checks_pr
pr_test run_tests_pr
else else
set -e set -e
default_test run_tests
fi fi
echo 'Test ran succesfully!' echo 'Test ran succesfully!'