summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Skyttä <ville.skytta@iki.fi>2010-01-24 23:02:12 +0200
committerVille Skyttä <ville.skytta@iki.fi>2010-01-24 23:32:19 +0200
commit89e52de0c587b3557fac33b4b0581fd886a51439 (patch)
tree14464e9dcbdae41469d2d184469262f24499c595
parent836adbbb2d0147029edf9062e72d8152cfda577b (diff)
downloadbash-completion-89e52de0c587b3557fac33b4b0581fd886a51439.tar.gz
(testsuite) Fix cvsps non-option completion test, add test for options.
"cvsps " completion failed when there was nothing in ~/.cvspass, create a fixture for generic cvs use containing one, and use it.
-rw-r--r--test/fixtures/cvs/.cvspass2
-rw-r--r--test/lib/completions/cvsps.exp20
2 files changed, 20 insertions, 2 deletions
diff --git a/test/fixtures/cvs/.cvspass b/test/fixtures/cvs/.cvspass
new file mode 100644
index 00000000..e7e0dce7
--- /dev/null
+++ b/test/fixtures/cvs/.cvspass
@@ -0,0 +1,2 @@
+/1 :pserver:anonymous@cvs.savannah.nongnu.org:2401/sources/cvs A
+/1 :pserver:anonymous@cvs.fedoraproject.org:2401/cvs/pkgs A
diff --git a/test/lib/completions/cvsps.exp b/test/lib/completions/cvsps.exp
index add74c0b..1fd4a0a9 100644
--- a/test/lib/completions/cvsps.exp
+++ b/test/lib/completions/cvsps.exp
@@ -1,17 +1,33 @@
proc setup {} {
save_env
+ assert_bash_exec {OLDHOME=$HOME ; HOME=$TESTDIR/fixtures/cvs}
}; # setup()
proc teardown {} {
- assert_env_unmodified
+ assert_bash_exec {HOME=$OLDHOME}
+ assert_env_unmodified {
+ /OLDHOME=/d
+ }
}; # teardown()
setup
-assert_complete_any "cvsps "
+assert_complete_any "cvsps -"
+
+
+sync_after_int
+
+
+set test "No arguments should complete CVS roots"
+set cmd "cvsps "
+send "$cmd\t"
+expect {
+ -re "^$cmd\r\n.*:pserver:.*\r\n/@$cmd:pserver:.*$" { pass "$test" }
+ default { fail "$test" }
+}; # expect
sync_after_int