[Bash-completion-commits] [bash-completion] 02/03: (testsuite): move testing of _linux_fstab() to umount.exp

Igor Murzov garik-guest at moszumanska.debian.org
Sun Jun 8 21:50:45 UTC 2014


This is an automated email from the git hooks/post-receive script.

garik-guest pushed a commit to branch master
in repository bash-completion.

commit dcb0ea2ca29cf2c335f1b075f51290d023fcda2e
Author: Igor Murzov <e-mail at date.by>
Date:   Mon Jun 9 01:34:28 2014 +0400

    (testsuite): move testing of _linux_fstab() to umount.exp
    
    The function is only used for umount completion.
---
 test/lib/completions/mount.exp  | 81 ----------------------------------------
 test/lib/completions/umount.exp | 83 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 82 insertions(+), 82 deletions(-)

diff --git a/test/lib/completions/mount.exp b/test/lib/completions/mount.exp
index 1298f36..fea99b8 100644
--- a/test/lib/completions/mount.exp
+++ b/test/lib/completions/mount.exp
@@ -1,35 +1,9 @@
-# mount completion from fstab can't be tested directly because it
-# (correctly) uses absolute paths. So we create a custom completion which
-# reads from a file in our text fixture instead.
-proc setup_dummy_mnt {} {
-    assert_bash_exec {unset COMPREPLY cur}
-    assert_bash_exec {unset -f _mnt}
-
-    assert_bash_exec { \
-        _mnt() { \
-            local cur=$(_get_cword); \
-            _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
-        }; \
-        complete -F _mnt mnt \
-    }
-}
-
-
-proc teardown_dummy_mnt {} {
-    assert_bash_exec {unset COMPREPLY cur}
-    assert_bash_exec {unset -f _mnt}
-    assert_bash_exec {complete -r mnt}
-}
-
-
 proc setup {} {
     save_env
-    setup_dummy_mnt
 }
 
 
 proc teardown {} {
-    teardown_dummy_mnt
     assert_env_unmodified {/OLDPWD/d}
 }
 
@@ -69,59 +43,4 @@ assert_bash_exec {PATH="$OLDPATH"; unset -v OLDPATH}
 sync_after_int
 
 
-set test "Testing internal __linux_fstab_unescape function for mount"
-# One round of slashes is for bash.
-assert_bash_exec {var=one\'two\\040three\\}
-assert_bash_exec {__linux_fstab_unescape var}
-set cmd {echo $var}
-send "$cmd\r"
-expect {
-    -ex "$cmd\r\none'two three\\" { pass $test }
-#    default { fail $test }
-}
-sync_after_int
-assert_bash_exec {unset var}
-
-
-sync_after_int
-
-
-# Begin testing through mnt (see setup_dummy_mnt).
-assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p}
-sync_after_int
-
-assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p}
-sync_after_int
-
-assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \
-    {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ }
-sync_after_int
-
-assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
-sync_after_int
-
-assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'}
-sync_after_int
-
-assert_complete {/mnt/other\'test\ path} {mnt /mnt/other}
-sync_after_int
-
-assert_complete {Ubuntu\ Karmic} {mnt -L Ubu}
-sync_after_int
-
-assert_complete {Debian-it\'s\ awesome} {mnt -L Deb}
-sync_after_int
-
-# This does not work. Proper support for this requires smarter parsing of
-# $COMP_LINE and it's not worth doing just for mount.
-#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n}
-#sync_after_int
-
-
 teardown
diff --git a/test/lib/completions/umount.exp b/test/lib/completions/umount.exp
index 21a2dfa..e7703d1 100644
--- a/test/lib/completions/umount.exp
+++ b/test/lib/completions/umount.exp
@@ -1,10 +1,36 @@
+# umount completion from fstab can't be tested directly because it
+# (correctly) uses absolute paths. So we create a custom completion which
+# reads from a file in our text fixture instead.
+proc setup_dummy_mnt {} {
+    assert_bash_exec {unset COMPREPLY cur}
+    assert_bash_exec {unset -f _mnt}
+
+    assert_bash_exec { \
+        _mnt() { \
+            local cur=$(_get_cword); \
+            _linux_fstab $(_get_pword) < "$SRCDIRABS/fixtures/mount/test-fstab"; \
+        }; \
+        complete -F _mnt mnt \
+    }
+}
+
+
+proc teardown_dummy_mnt {} {
+    assert_bash_exec {unset COMPREPLY cur}
+    assert_bash_exec {unset -f _mnt}
+    assert_bash_exec {complete -r mnt}
+}
+
+
 proc setup {} {
     save_env
+    setup_dummy_mnt
 }
 
 
 proc teardown {} {
-    assert_env_unmodified
+    teardown_dummy_mnt
+    assert_env_unmodified {/OLDPWD/d}
 }
 
 
@@ -17,4 +43,59 @@ assert_complete_any "umount "
 sync_after_int
 
 
+set test "Testing internal __linux_fstab_unescape function for umount"
+# One round of slashes is for bash.
+assert_bash_exec {var=one\'two\\040three\\}
+assert_bash_exec {__linux_fstab_unescape var}
+set cmd {echo $var}
+send "$cmd\r"
+expect {
+    -ex "$cmd\r\none'two three\\" { pass $test }
+#    default { fail $test }
+}
+sync_after_int
+assert_bash_exec {unset var}
+
+
+sync_after_int
+
+
+# Begin testing through mnt (see setup_dummy_mnt).
+assert_complete {/mnt/nice-test-path} {mnt /mnt/nice-test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test-path} {mnt /mnt/nice\ test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$test-p}
+sync_after_int
+
+assert_complete {/mnt/nice\ test\\path} {mnt /mnt/nice\ test\\p}
+sync_after_int
+
+assert_complete {{/mnt/nice\ test\\path} {/mnt/nice\ test-path}} \
+    {mnt /mnt/nice\ } "" -expect-cmd-minus {/mnt/nice\ }
+sync_after_int
+
+assert_complete {/mnt/nice\$test-path} {mnt /mnt/nice\$}
+sync_after_int
+
+assert_complete {/mnt/nice\'test-path} {mnt /mnt/nice\'}
+sync_after_int
+
+assert_complete {/mnt/other\'test\ path} {mnt /mnt/other}
+sync_after_int
+
+assert_complete {Ubuntu\ Karmic} {mnt -L Ubu}
+sync_after_int
+
+assert_complete {Debian-it\'s\ awesome} {mnt -L Deb}
+sync_after_int
+
+# This does not work. Proper support for this requires smarter parsing of
+# $COMP_LINE and it's not worth doing just for umount.
+#assert_complete {$'/mnt/nice\ntest-path'} {mnt $'/mnt/nice\n}
+#sync_after_int
+
+
 teardown

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list