Skip to content

Commit

Permalink
MOD: bash_unit.yml test_bashew.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pforret committed May 19, 2024
1 parent d6011da commit 27c602d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/bash_unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: ls ./*.sh | xargs bash

- name: Unit testing with bash_unit
run: curl https://raw.githubusercontent.com/pgrange/bash_unit/master/bash_unit -o tests/bash_unit && chmod +x tests/bash_unit && tests/bash_unit tests/test_*
run: curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/bash_unit -o tests/bash_unit && chmod +x tests/bash_unit && tests/bash_unit tests/test_*

macos:
runs-on: macos-latest
Expand All @@ -33,4 +33,4 @@ jobs:
run: ls ./*.sh | xargs bash

- name: Unit testing with bash_unit
run: curl https://raw.githubusercontent.com/pgrange/bash_unit/master/bash_unit -o tests/bash_unit && chmod +x tests/bash_unit && tests/bash_unit tests/test_*
run: curl -s https://raw.githubusercontent.com/pgrange/bash_unit/master/bash_unit -o tests/bash_unit && chmod +x tests/bash_unit && tests/bash_unit tests/test_*
7 changes: 4 additions & 3 deletions tests/test_bashew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ template_script="$template_folder/script.sh"

test_3_create_normal_script() {
# script without parameters should give usage info
local temp_folder current_folder
temp_folder="./test.$RANDOM"
current_folder=$(pwd)
mkdir "$temp_folder"
Expand All @@ -29,11 +30,11 @@ test_3_create_normal_script() {

test_1_show_option_verbose() {
# script without parameters should give usage info
assert_equals 1 "$("$template_script" 2>&1 | grep -c "verbose")"
assert_equals 1 "$("$template_script" 2>&1 | grep -c "VERBOSE")"
}

test_2_action_check_works() {
# script without parameters should give usage info
assert_equals 1 "$("$template_script" check 2>&1 | grep -c "verbose=")"
assert_equals 1 "$("$template_script" check 2>&1 | grep -c "log_dir=")"
assert_equals 1 "$("$template_script" check 2>&1 | grep -c "VERBOSE=")"
assert_equals 1 "$("$template_script" check 2>&1 | grep -c "LOG_DIR=")"
}

0 comments on commit 27c602d

Please sign in to comment.