summaryrefslogtreecommitdiff
path: root/tests/completion.at
diff options
context:
space:
mode:
authorAlex Wang <alexw@nicira.com>2015-03-13 14:47:25 -0700
committerAlex Wang <alexw@nicira.com>2015-03-20 16:42:42 -0700
commitbb5dbe78592b3f39f0e7e6361c8796a5023363e5 (patch)
treee8baaafc0b8217d05def9739f65685b50d4609f5 /tests/completion.at
parent777cb78767fd0ca821dad79691ee3200de66f06e (diff)
downloadopenvswitch-bb5dbe78592b3f39f0e7e6361c8796a5023363e5.tar.gz
ovs-vsctl-bashcomp: Avoid setting the COMP_WORDBREAKS.
Modifying $COMP_WORDBREAKS in completion script is not the recommended as it is a global variable and the modification could affect the behavior of other completion scripts. As a workaround, this commit uses the _get_comp_words_by_ref which allows user to exclude characters out of $COMP_WORDBREAKS and reassemble input command line. However, as a side effect, the bash completion module cannot handle characters defined in $COMP_WORDBREAKS (e.g. ':' and '=') correctly in the resulting completions. Thusly, we need to trim the colon-word and equal-word prefixes from reply. Signed-off-by: Alex Wang <alexw@nicira.com>
Diffstat (limited to 'tests/completion.at')
-rw-r--r--tests/completion.at10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/completion.at b/tests/completion.at
index d3b280046..0aca7aabb 100644
--- a/tests/completion.at
+++ b/tests/completion.at
@@ -608,7 +608,7 @@ AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "add Bridge br0 other_config ran
[0], [dnl
${MATCH}
])
-MATCH="$(PREPARE_MATCH_NOSPACE(random_key=abc))"
+MATCH="$(PREPARE_MATCH_NOSPACE(abc))"
AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "add Bridge br0 other_config random_key=abc"],
[0], [dnl
${MATCH}
@@ -638,14 +638,14 @@ AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set Bridge br0 other"],
${MATCH}
])
# then, with the ':' we should complete on key.
-TMP="$(ovs-vsctl --no-heading --columns=other_config list Bridge br0 | tr -d '{\"}' | tr -s ', ' '\n' | cut -d'=' -f1 | xargs printf "other_config:%s\n")"
+TMP="$(ovs-vsctl --no-heading --columns=other_config list Bridge br0 | tr -d '{\"}' | tr -s ', ' '\n' | cut -d'=' -f1)"
MATCH="$(PREPARE_MATCH_NOSPACE(${TMP}))"
AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set Bridge br0 other_config:"],
[0], [dnl
${MATCH}
])
# finally, if user fill in some value, we should just complete on user input.
-MATCH="$(PREPARE_MATCH_NOSPACE(other_config:random_val1=12345))"
+MATCH="$(PREPARE_MATCH_NOSPACE(random_val1))"
AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set Bridge br0 other_config:random_val1=12345"],
[0], [dnl
${MATCH}
@@ -677,14 +677,14 @@ AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set-manager "],
${MATCH}
])
# filename completion on unix, punix.
-MATCH="$(PREPARE_MATCH_NOSPACE(unix:testsuite.log))"
+MATCH="$(PREPARE_MATCH_NOSPACE(testsuite.log))"
AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set-manager unix:test"],
[0], [dnl
${MATCH}
])
# no completion on other type, just return available types.
# in real environment, bash will not complete on anything.
-MATCH="$(PREPARE_MATCH_NOSPACE(pssl: ptcp: punix: ssl: tcp: unix:))"
+MATCH="$(PREPARE_MATCH_NOSPACE(pssl: ptcp: punix: tcp: unix:))"
AT_CHECK_UNQUOTED([ovs-vsctl-bashcomp.bash test "set-manager ssl:something"],
[0], [dnl
${MATCH}