@@ -5,22 +5,33 @@ load environment
5
5
create_aliases_test_command_script () {
6
6
@go.create_test_go_script \
7
7
' 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 \$ @"
9
12
}
10
13
11
- @test " $SUITE : with no arguments, list all aliases" {
14
+ @test " $SUITE : with no arguments, list all predefined aliases" {
12
15
run ./go aliases
13
16
assert_success
14
17
assert_line_equals 0 ' awk' # first alias
15
18
assert_line_equals -1 ' sed' # last alias
16
19
}
17
20
18
21
@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'
21
24
assert_success
22
25
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'
24
35
}
25
36
26
37
@test " $SUITE : tab completions" {
@@ -112,7 +123,7 @@ create_aliases_test_command_script() {
112
123
@test " $SUITE : leave help generic for cd, pushd when using env function" {
113
124
# Setting _GO_CMD will trick the script into thinking the shell function is
114
125
# running it.
115
-
126
+
116
127
_GO_CMD=' test-go' run ./go aliases --help cd
117
128
[ " $status " -eq ' 0' ]
118
129
0 commit comments