File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 3030# Returns:
3131# zero if `result_var` contains the user's selection, nonzero otherwise
3232@go.select_option () {
33- @go.validate_identifier_or_die ' Result variable name' " $1 "
33+ @go.validate_identifier_or_die ' Input selection variable name' " $1 "
3434
3535 local __go_selected_option
3636 select __go_selected_option in " ${@: 2} " ; do
Original file line number Diff line number Diff line change @@ -18,6 +18,20 @@ teardown() {
1818 @go.remove_test_go_rootdir
1919}
2020
21+ @test " $SUITE : error if selection variable not a valid identifier" {
22+ @go.create_test_go_script ' . "$_GO_USE_MODULES" "prompt"' \
23+ ' @go.select_option "invalid;"'
24+
25+ run " $TEST_GO_SCRIPT "
26+ assert_failure
27+
28+ local err_msg=' Input selection variable name "invalid;" for '
29+ err_msg+=' @go.select_option contains invalid identifier characters at:'
30+
31+ assert_lines_match " ^${err_msg} \$ " \
32+ " ^ $TEST_GO_SCRIPT :[0-9] main$"
33+ }
34+
2135@test " $SUITE : no options exits instantly" {
2236 run " $TEST_GO_SCRIPT "
2337 assert_failure ' '
You can’t perform that action at this time.
0 commit comments