From 14e4ecf435c542b9e4a41c00fb0b34ef5e4b7d8a Mon Sep 17 00:00:00 2001 From: Brandon Rodriguez <brodriguez8774@gmail.com> Date: Sun, 25 Oct 2020 19:00:01 -0400 Subject: [PATCH] Correct syntax for proper, updated bats source --- tests/test.sh | 10 +++++----- tests/test_text_functions.sh | 5 ----- tests/test_user_functions.sh | 22 ++++++++-------------- tests/test_user_functions_sudo.sh | 13 ++++--------- 4 files changed, 17 insertions(+), 33 deletions(-) diff --git a/tests/test.sh b/tests/test.sh index ea748c0..6ff9202 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -21,7 +21,7 @@ sudo ls > /dev/null 2>&1 # Run Directory Function tests. echo "" echo -e "Running ${text_purple}Directory Function${text_reset} tests." -./libs/bats/bin/bats ./test_directory_functions.sh +bats ./test_directory_functions.sh echo -e "Finished ${text_purple}Directory Function${text_reset} Tests." echo "" @@ -29,8 +29,8 @@ echo "" # Run User Function tests. echo "" echo -e "Running ${text_purple}User Function${text_reset} tests." -./libs/bats/bin/bats ./test_user_functions.sh -sudo ./libs/bats/bin/bats ./test_user_functions_sudo.sh +bats ./test_user_functions.sh +sudo bats ./test_user_functions_sudo.sh echo -e "Finished ${text_purple}User Function${text_reset} tests." echo "" @@ -38,7 +38,7 @@ echo "" # Run Text Function tests. echo "" echo -e "Running ${text_purple}Text Function${text_reset} tests." -./libs/bats/bin/bats ./test_text_functions.sh +bats ./test_text_functions.sh echo -e "Finished ${text_purple}Text Function${text_reset} tests." echo "" @@ -46,6 +46,6 @@ echo "" # Run Display Function tests. echo "" echo -e "Running ${text_purple}Display Function${text_reset} tests." -./libs/bats/bin/bats ./test_display_functions.sh +bats ./test_display_functions.sh echo -e "Finished ${text_purple}Display Function${text_reset} tests." echo "" diff --git a/tests/test_text_functions.sh b/tests/test_text_functions.sh index ab633fe..b378fe2 100755 --- a/tests/test_text_functions.sh +++ b/tests/test_text_functions.sh @@ -4,11 +4,6 @@ ## -# Load UnitTesting libraries. -load 'libs/bats-assert/load' -load 'libs/bats-support/load' - - setup() { mixed_case_var="ThisIsMixedCase" } diff --git a/tests/test_user_functions.sh b/tests/test_user_functions.sh index 5900bfb..ebc8f08 100755 --- a/tests/test_user_functions.sh +++ b/tests/test_user_functions.sh @@ -4,18 +4,12 @@ ## -# Load UnitTesting libraries. -load 'libs/bats-assert/load' -load 'libs/bats-support/load' - - - @test "User Function - check_is_user - Success - Current User" { # Import utils script. source ../utils.sh run $(check_is_user ${USER}) - assert_success + [[ "${status}" == 0 ]] } @@ -24,7 +18,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_user "some_test_user") - assert_failure + [[ "${status}" != 1 ]] } @@ -33,7 +27,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_user "sudo") - assert_failure + [[ "${status}" != 1 ]] } @@ -42,7 +36,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_user "root") - assert_failure + [[ "${status}" != 1 ]] } @@ -51,7 +45,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user "some_test_user") - assert_success + [[ "${status}" == 0 ]] } @@ -60,7 +54,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user "sudo") - assert_success + [[ "${status}" == 0 ]] } @@ -69,7 +63,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user "root") - assert_success + [[ "${status}" == 0 ]] } @@ -78,5 +72,5 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user ${USER}) - assert_failure + [[ "${status}" != 1 ]] } diff --git a/tests/test_user_functions_sudo.sh b/tests/test_user_functions_sudo.sh index e94de55..f7ff163 100644 --- a/tests/test_user_functions_sudo.sh +++ b/tests/test_user_functions_sudo.sh @@ -4,17 +4,12 @@ ## -# Load UnitTesting libraries. -load 'libs/bats-assert/load' -load 'libs/bats-support/load' - - @test "User Function - check_is_user - Success - Sudo" { # Import utils script. source ../utils.sh run $(check_is_user "sudo") - assert_success + [[ "${status}" == 0 ]] } @@ -23,7 +18,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_user "root") - assert_success + [[ "${status}" == 0 ]] } @@ -32,7 +27,7 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user "sudo") - assert_failure + [[ "${status}" != 1 ]] } @@ -41,5 +36,5 @@ load 'libs/bats-support/load' source ../utils.sh run $(check_is_not_user "root") - assert_failure + [[ "${status}" != 1 ]] } -- GitLab