summaryrefslogtreecommitdiff
path: root/test/unit/_get_cword.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/_get_cword.exp')
-rw-r--r--test/unit/_get_cword.exp58
1 files changed, 29 insertions, 29 deletions
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
index 1e6e9bfb..ce749cec 100644
--- a/test/unit/_get_cword.exp
+++ b/test/unit/_get_cword.exp
@@ -1,7 +1,7 @@
proc setup {} {
assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
save_env
-}; # setup()
+}
proc teardown {} {
@@ -12,7 +12,7 @@ proc teardown {} {
d
}
}
-}; # teardown()
+}
setup
@@ -30,7 +30,7 @@ sync_after_int
set test "a b| should return b"; # | = cursor position
-set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_cword}
+set cmd {COMP_WORDS=(a b); COMP_CWORD=1; COMP_LINE='a b'; COMP_POINT=3; _get_cword; echo}
assert_bash_list b $cmd $test
@@ -65,7 +65,7 @@ sync_after_int
set test "a b|c should return b"; # | = cursor position
-set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_cword}
+set cmd {COMP_WORDS=(a bc); COMP_CWORD=1; COMP_LINE='a bc'; COMP_POINT=3; _get_cword; echo}
assert_bash_list b $cmd $test
@@ -73,7 +73,7 @@ sync_after_int
set test {a b\ c| should return b\ c}; # | = cursor position
-set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_cword}
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=6; _get_cword; echo}
assert_bash_list {"b\\ c"} $cmd $test
@@ -81,7 +81,7 @@ sync_after_int
set test {a b\| c should return b\ }; # | = cursor position
-set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_cword}
+set cmd {COMP_WORDS=(a 'b\ c'); COMP_CWORD=1; COMP_LINE='a b\ c'; COMP_POINT=4; _get_cword; echo}
assert_bash_list {"b\\"} $cmd $test
@@ -89,7 +89,7 @@ sync_after_int
set test {a "b\| should return "b\ }; # | = cursor position
-set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_cword}
+set cmd {COMP_WORDS=(a '"b\'); COMP_CWORD=1; COMP_LINE='a "b\'; COMP_POINT=5; _get_cword; echo}
assert_bash_list {"\"b\\"} $cmd $test
@@ -105,7 +105,7 @@ if {
set cmd {COMP_WORDS=(a "'" b c); COMP_CWORD=3}
} else {
set cmd {COMP_WORDS=(a "'b c"); COMP_CWORD=1}
-}; # if
+}
append cmd {; COMP_LINE="a 'b c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
@@ -118,7 +118,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -133,7 +133,7 @@ if {
set cmd {COMP_WORDS=(a "\"" b c); COMP_CWORD=3}
} else {
set cmd {COMP_WORDS=(a "\"b c"); COMP_CWORD=1}
-}; # if
+}
append cmd {; COMP_LINE="a \"b c"; COMP_POINT=6; _get_cword};
send "$cmd\r"
expect -ex "$cmd\r\n"
@@ -146,7 +146,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int
@@ -159,8 +159,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
} else {
set cmd {add_comp_wordbreak_char :; COMP_WORDS=(a b : c); COMP_CWORD=3}
set expected c
-}; # if
-append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword}
+}
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -172,8 +172,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
set cmd {COMP_WORDS=(a "b:c"); COMP_CWORD=1}
} else {
set cmd {COMP_WORDS=(a b : c); COMP_CWORD=3}
-}; # if
-append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :}
+}
+append cmd {; COMP_LINE='a b:c'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:c $cmd $test
@@ -185,8 +185,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
set cmd {COMP_WORDS=(a b c:); COMP_CWORD=2}
} else {
set cmd {COMP_WORDS=(a b c :); COMP_CWORD=3}
-}; # if
-append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :}
+}
+append cmd {; COMP_LINE='a b c:'; COMP_POINT=6; _get_cword :; echo}
assert_bash_list c: $cmd $test
@@ -194,7 +194,7 @@ sync_after_int
set test {a :| with WORDBREAKS -= : should return :}; # | = cursor position
-set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3; _get_cword :}
+set cmd {COMP_WORDS=(a :); COMP_CWORD=1; COMP_LINE='a :'; COMP_POINT=3; _get_cword :; echo}
assert_bash_list : $cmd $test
@@ -206,8 +206,8 @@ if {[lindex $::BASH_VERSINFO 0] <= 3} {
set cmd {COMP_WORDS=(a "b::"); COMP_CWORD=1}
} else {
set cmd {COMP_WORDS=(a b ::); COMP_CWORD=2}
-}; # if
-append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :}
+}
+append cmd {; COMP_LINE='a b::'; COMP_POINT=5; _get_cword :; echo}
assert_bash_list b:: $cmd $test
@@ -217,7 +217,7 @@ sync_after_int
# This test makes sure `_get_cword' doesn't use `echo' to return it's value,
# because -n might be interpreted by `echo' and thus will not be returned.
set test "a -n| should return -n"; # | = cursor position
-set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4; _get_cword}
+set cmd {COMP_WORDS=(a -n); COMP_CWORD=1; COMP_LINE='a -n'; COMP_POINT=4; _get_cword; echo}
assert_bash_list -n $cmd $test
@@ -225,7 +225,7 @@ sync_after_int
set test {a b>c| should return c}; # | = cursor position
-set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5; _get_cword}
+set cmd {COMP_WORDS=(a b \> c); COMP_CWORD=3; COMP_LINE='a b>c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list c $cmd $test
@@ -239,8 +239,8 @@ if {[lindex $::BASH_VERSINFO] <= 3} {
} else {
set cmd {COMP_WORDS=(a b = c); COMP_CWORD=3}
set expected c
-}; # if
-append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword}
+}
+append cmd {; COMP_LINE='a b=c'; COMP_POINT=5; _get_cword; echo}
assert_bash_list $expected $cmd $test
@@ -248,7 +248,7 @@ sync_after_int
set test {a *| should return *}; # | = cursor position
-set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4; _get_cword}
+set cmd {COMP_WORDS=(a \*); COMP_CWORD=1; COMP_LINE='a *'; COMP_POINT=4; _get_cword; echo}
assert_bash_list * $cmd $test
@@ -264,7 +264,7 @@ expect {
-ex "\$(b c/@" { pass "$test" }
# Expected failure on bash-4
-ex "c/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -279,7 +279,7 @@ expect {
-ex "\$(b c\\ d/@" { pass "$test" }
# Expected failure on bash-4
-ex "c\\ d/@" { xfail "$test" }
-}; # expect
+}
sync_after_int
@@ -294,7 +294,7 @@ if {
set cmd {COMP_WORDS=(a "'" b "&" c); COMP_CWORD=4}
} else {
set cmd {COMP_WORDS=(a "'b&c"); COMP_CWORD=1}
-}; # if
+}
append cmd {; COMP_LINE="a 'b&c"; COMP_POINT=6; _get_cword}
send "$cmd\r"
expect -ex "$cmd\r\n"
@@ -307,7 +307,7 @@ expect {
[lindex $::BASH_VERSINFO 2] < 35
} {xfail "$test"} {fail "$test"}
}
-}; # expect
+}
sync_after_int