Skip to content

Commit

Permalink
Merge pull request #60 from wcarhart/bugfix/joint-arguments
Browse files Browse the repository at this point in the history
Added test for joint arg bug
  • Loading branch information
wcarhart authored May 13, 2020
2 parents 1260e55 + 4165661 commit b76d647
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/scripts/jointargs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

source ../../koi
koiname=jointargs.sh
koidescription="Testing joint arguments"

function testfunc {
__addarg "-h" "--help" "help" "optional" "" "help text"
__addarg "" "--flag" "flag" "optional" "" "help text"
__addarg "-g" "--glad" "flag" "optional" "" "help text"
__parseargs "$@"
echo "flag: $flag"
echo "glad: $glad"
}

__koirun "$@"
8 changes: 8 additions & 0 deletions tests/test_actions/test_action_flag/test_action_flag_valid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,19 @@ function test_action_flag_valid_optional_without_value {
echo "$flag"
}

function test_action_flag_valid_joint_args_invalid_shortname {
__addarg "" "--flag" "flag" "optional" "" "help text"
__addarg "-g" "--glad" "flag" "optional" "" "help text"
__parseargs "$@"
echo "$flag $glad"
}

# ========= ASSERTIONS ========= #
function koitest_run {
runtest test_action_flag_valid_required "1" "-f"
runtest test_action_flag_valid_required __error__ ""
runtest test_action_flag_valid_no_consume_arguments "1 arg" "-f" "-a" "arg"
runtest test_action_flag_valid_optional_with_value "1" "-f"
runtest test_action_flag_valid_optional_without_value "0"
runtest test_action_flag_valid_joint_args_invalid_shortname __error__ "-fg"
}

0 comments on commit b76d647

Please sign in to comment.