[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 451b92037796cf2b626a7a2e7807447d7c9177a7

Freddy Vulto fvulto at gmail.com
Wed Sep 16 20:22:18 UTC 2009


The following commit has been merged in the master branch:
commit fe88919de4c1ddbf7a3ef979bef36ea39b8d0541
Author: Freddy Vulto <fvulto at gmail.com>
Date:   Wed Sep 16 22:14:53 2009 +0200

    (testsuite) Fix assert_env_unmodified() & get_hosts_avahi()
    assert_env_unmodified() now calls `diff_env' with `LAST-ARG' as the last
    argument.  Now $_ becomes `LAST_ARG' and $_ doesn't interfere with the
    diff anymore as it would if $_ was the sed script.
    
    Added line continuation (\) to bash script of `get_hosts_avahi()'.

diff --git a/test/lib/library.exp b/test/lib/library.exp
index ba225fc..4b92cf4 100644
--- a/test/lib/library.exp
+++ b/test/lib/library.exp
@@ -225,8 +225,6 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
     regsub -all {([\"\\])} $sed {\\\1} sed
         # Escape newlines
     regsub -all {\n} [string trim $sed] "\r\n" sed
-        # Mark end of sed script, so that `expect' can match on that
-    append sed "# End of sed script"
 
         # Prepare diff script
 
@@ -240,9 +238,12 @@ proc assert_env_unmodified {{sed ""} {file ""} {diff ""}} {
 
         # Execute diff
 
-    set cmd "diff_env \"[gen_env_filename $file 1]\" \"[gen_env_filename $file 2]\" \"$sed\""
+    # NOTE: The dummy argument 'LAST-ARG' sets bash variable $_ (last argument) to
+    #       'LAST-ARG' so that $_ doesn't mess up the diff (as it would if $_
+    #       was the (possibly multi-lined) sed script).
+    set cmd "diff_env \"[gen_env_filename $file 1]\" \"[gen_env_filename $file 2]\" \"$sed\" LAST-ARG"
     send "$cmd\r"
-    expect "# End of sed script\"\r\n"
+    expect "LAST-ARG\r\n"
 
     expect {
         -re "^$diff[wd]@$" { pass "$test" }
@@ -313,7 +314,7 @@ proc get_hosts {} {
 proc get_hosts_avahi {} {
         # Retrieving hosts is successful?
     if { [catch {exec bash -c {
-        type avahi-browse >&/dev/null && [ -n "$(pidof avahi-daemon)" ]
+        type avahi-browse >&/dev/null && [ -n "$(pidof avahi-daemon)" ] \
             && avahi-browse -cpr _workstation._tcp | grep ^= | cut -d\; -f7 | sort -u
     }} hosts] } {
         # No, retrieving hosts yields error;

-- 
bash-completion



More information about the Bash-completion-commits mailing list