@@ -5,22 +5,33 @@ load environment
55create_aliases_test_command_script () {
66 @go.create_test_go_script \
77 ' declare -a GO_ALIAS_CMDS_EXTRA=("nvim")' \
8- " @go $@ "
8+ ' declare -a GO_ALIAS_EXPAND_CMDS=("test_echo")' \
9+ ' shopt -s expand_aliases' \
10+ ' alias test_echo="echo -n test_string_19098e09818fad"' \
11+ " @go \$ @"
912}
1013
11- @test " $SUITE : with no arguments, list all aliases" {
14+ @test " $SUITE : with no arguments, list all predefined aliases" {
1215 run ./go aliases
1316 assert_success
1417 assert_line_equals 0 ' awk' # first alias
1518 assert_line_equals -1 ' sed' # last alias
1619}
1720
1821@test " $SUITE : list custom aliases if defined" {
19- create_aliases_test_command_script ' aliases '
20- run " $TEST_GO_SCRIPT " aliases
22+ create_aliases_test_command_script
23+ run " $TEST_GO_SCRIPT " ' aliases'
2124 assert_success
2225 assert_line_equals 0 ' awk' # first alias
23- assert_line_equals -1 ' nvim' # last alias
26+ assert_line_equals -2 ' nvim' # second to last alias
27+ assert_line_equals -1 ' test_echo' # last alias
28+ }
29+
30+ @test " $SUITE : run expanded aliases if defined" {
31+ create_aliases_test_command_script ' aliases'
32+ run " $TEST_GO_SCRIPT " ' test_echo'
33+ assert_success
34+ assert_line_equals 0 ' test_string_19098e09818fad'
2435}
2536
2637@test " $SUITE : tab completions" {
@@ -112,7 +123,7 @@ create_aliases_test_command_script() {
112123@test " $SUITE : leave help generic for cd, pushd when using env function" {
113124 # Setting _GO_CMD will trick the script into thinking the shell function is
114125 # running it.
115-
126+
116127 _GO_CMD=' test-go' run ./go aliases --help cd
117128 [ " $status " -eq ' 0' ]
118129
0 commit comments