[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 359d242a495fc2072fa99b85e55650a6d6f86221

Freddy Vulto fvulto at gmail.com
Sat Dec 12 11:38:09 UTC 2009


The following commit has been merged in the master branch:
commit 359d242a495fc2072fa99b85e55650a6d6f86221
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Sat Dec 12 12:36:38 2009 +0100

    (testsuite) Unset COMP_ variables at setup()
    The COMP_ settings of the last test of _count_args() were falling through to
    the first test of _get_cword(), causing it to fail.
    
    Unset COMP_ variables within the unit tests setup & teardown.
    
    Fixed last test at `_count_args.exp' by solving conflicting settings of
    COMP_CWORD and COMP_POINT.
    
    Steps to reproduce the problem:
    
        $ ./runUnit _count_args.exp _get_cword.exp
        ...
        Running ./unit/_count_args.exp ...
        Running ./unit/_get_cword.exp ...
        ERROR Unexpected output from bash command "_get_cword should run without errors":
        bash: $index: substring expression < 0
        ...

diff --git a/test/unit/_count_args.exp b/test/unit/_count_args.exp
index 48e4cea..fa5417e 100644
--- a/test/unit/_count_args.exp
+++ b/test/unit/_count_args.exp
@@ -1,15 +1,12 @@
 proc setup {} {
+    assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
     save_env
 }; # setup()
 
 
 proc teardown {} {
+    assert_bash_exec {unset args COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
     assert_env_unmodified {
-        /args=/d
-        /COMP_CWORD=/d
-        /COMP_LINE=/d
-        /COMP_POINT=/d
-        /COMP_WORDS=/d
         # Delete 'COMP_WORDBREAKS' occupying two lines
         /COMP_WORDBREAKS=/{N
         d}
@@ -60,7 +57,7 @@ sync_after_int
 
 
 set test "a b -c| d should set args to 2";  # | = cursor position
-set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=3; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo -n $args}
+set cmd {COMP_WORDS=(a b -c d); COMP_CWORD=2; COMP_LINE='a b -c d'; COMP_POINT=6; _count_args; echo -n $args}
 assert_bash_list 2 $cmd $test
 
 
diff --git a/test/unit/_get_cword.exp b/test/unit/_get_cword.exp
index cd2184e..3481b4a 100644
--- a/test/unit/_get_cword.exp
+++ b/test/unit/_get_cword.exp
@@ -1,14 +1,12 @@
 proc setup {} {
+    assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
     save_env
 }; # setup()
 
 
 proc teardown {} {
+    assert_bash_exec {unset COMP_CWORD COMP_LINE COMP_POINT COMP_WORDS}
     assert_env_unmodified {
-        /COMP_CWORD=/d
-        /COMP_LINE=/d
-        /COMP_POINT=/d
-        /COMP_WORDS=/d
         # Delete 'COMP_WORDBREAKS' occupying two lines
         /COMP_WORDBREAKS=/{N
         d}

-- 
bash-completion



More information about the Bash-completion-commits mailing list