monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: 60b588f81b8355d8b02c774037


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: 60b588f81b8355d8b02c774037039a7a2483c0ae
Date: Fri, 18 Feb 2011 20:54:01 +0100 (CET)

revision:            60b588f81b8355d8b02c774037039a7a2483c0ae
date:                2011-02-06T19:03:11
author:              Richard Levitte <address@hidden>
branch:              net.venge.monotone
changelog:
There was a problem with readline (bash) and processes without a tty, as
well as terminals being 80 columns by default.  This was mostly resolved
by adding some settings in a bashrc (for bash) and a inputrc (for readline).

* test/extra/bash_completion/library.exp: Instead of sending a lot of
  stuff to the running shell, use a custom bashrc that does it all.
  (failure): Make it require a string that gets displayed with the
  failure marker.
* test/extra/bash_completion/bashrc, test/extra/bash_completion/inputrc:
  Added.
* test/extra/bash_completion/complete_commit.exp,
  test/extra/bash_completion/complete_mtn_-.exp,
  test/extra/bash_completion/complete_propagate.exp: Clean up and add
  more comments to the user.

* test/extra/bash_completion/__driver__.lua: Send srcdir to expect.  Make
  the propagate test preparations a little more complex.


manifest:
format_version "1"

new_manifest [2492bf5cd6096a396378ab81de1d1cc9d272a8e7]

old_revision [31600ac35f9ecae587d6c52fd6f96e7b34783f1b]

add_file "test/extra/bash_completion/bashrc"
 content [50253c70d06f889a476b8333d5013c5512a1ef57]

add_file "test/extra/bash_completion/inputrc"
 content [c8c7098b3ff90813e2877a5cef51dedd73c9c0f8]

patch "test/extra/bash_completion/__driver__.lua"
 from [b03741df3491cd5215c6e9c2104523ee58f03e47]
   to [48ab97476e92e8d9a6c11bdaa9696da8b3e5fc01]

patch "test/extra/bash_completion/complete_commit.exp"
 from [439e4abfd8e54e82a86bc7d131fc3f4d2d22eb7b]
   to [179fb7df2eb45341b0afb50473aff8500c547fc0]

patch "test/extra/bash_completion/complete_mtn_-.exp"
 from [5518c9ce3d09dafac3f3b9e9f8493811f71846c9]
   to [83a17fc2c594257ec71878f91b59564389fadb1b]

patch "test/extra/bash_completion/complete_propagate.exp"
 from [409ea6ac7a02318153e0aaf92f28232e8de2465f]
   to [779304f72ffc9d0b12a87253f81a7e7bbf467468]

patch "test/extra/bash_completion/library.exp"
 from [5e1a1081c1ebc852cb691c535abe426234ae679b]
   to [fe2bdcd48b3dae04cf4863d11bccb42b98ad01d5]
============================================================
--- test/extra/bash_completion/__driver__.lua	b03741df3491cd5215c6e9c2104523ee58f03e47
+++ test/extra/bash_completion/__driver__.lua	48ab97476e92e8d9a6c11bdaa9696da8b3e5fc01
@@ -14,8 +14,11 @@ local tests = {
 	 function ()
 	    addfile("prop-test", "foo")
 	    commit("prop-br1")
-	    writefile("prop-test", "bar")
+	    addfile("prop-test2", "bar")
 	    commit("prop-bra2")
+	    check(mtn("update","-r","h:prop-br1"), 0, false, false)
+	    writefile("prop-test", "zoot")
+	    commit("prop-br1")
 	 end,
       ["cleanup"] =
 	 function ()
@@ -45,6 +48,7 @@ function expect(test)
       check({"expect",
 	     "-c", "set mtn \""..cmd_as_str(mtn()).."\"",
 	     "-c", "set initial_dir \""..initial_dir.."\"",
+	     "-c", "set srcdir \""..srcdir.."\"",
 	     "-c", "source library.exp",
 	     "-f", test..".exp"}, 0, true, false)
       check(grep("<<success>>", "stdout"), 0, false, false)
============================================================
--- test/extra/bash_completion/complete_commit.exp	439e4abfd8e54e82a86bc7d131fc3f4d2d22eb7b
+++ test/extra/bash_completion/complete_commit.exp	179fb7df2eb45341b0afb50473aff8500c547fc0
@@ -1,26 +1,29 @@
-# This test checks that monotone.bash_completion2 can handle arguments that
+# This test checks that monotone.bash_completion can handle arguments that
 # are specified as 'PATH ...'
 
-set CTRLC \003
-set timeout 2
+send_user "\n===== BEGIN complete_commit  =====\n"
+expect -re "@ $"
+send "\n$mtn commit -m 'foobar' "
+expect {
+    -ex " commit " {}
+    timeout { failure "' commit '"; exit }
+}
 
-send "$mtn commit -m 'foobar' \t\t"
-expect "mtn commit"
+send "\t"
 expect {
-    -ex "commit-test1" {
-	expect {
-	    -ex "commit-test2" {
-	    }
-	}
-    }
-    timeout { failure; exit }
+    -ex "commit-test1" {}
+    timeout { failure "'commit-test1'"; exit }
 }
+expect {
+    -ex "commit-test2" {}
+    timeout { failure "'commit-test2'"; exit }
+}
 
-send "commit-test1 commit-test\t\t"
+send "commit-test1 commit-test\t"
 expect {
-    -ex "commit-test2" {
-	success
-    }
-    timeout { failure; exit }
+    -ex "commit-test2" {}
+    timeout { failure "'commit-test1 commit-test2'"; exit }
 }
-failure
+
+send_user "\n===== END complete_commit  =====\n"
+success
============================================================
--- test/extra/bash_completion/complete_mtn_-.exp	5518c9ce3d09dafac3f3b9e9f8493811f71846c9
+++ test/extra/bash_completion/complete_mtn_-.exp	83a17fc2c594257ec71878f91b59564389fadb1b
@@ -1,13 +1,12 @@
 # Check that something is compled with 'mtn -'
 
+send_user "\n===== BEGIN complete_mtn_-  =====\n"
+expect -re "@ $"
 send "$mtn -\t"
-#expect -ex "mtn -"
-send "\t"
 expect {
-    -timeout 2
-    -- "--no-workspace" {
-	success
-	exit
-    }
+    -gl "--no-workspace" {}
+    timeout { failure "'--no-workspace'"; exit }
 }
-failure
+
+send_user "\n===== END complete_mtn_-  =====\n"
+success
============================================================
--- test/extra/bash_completion/complete_propagate.exp	409ea6ac7a02318153e0aaf92f28232e8de2465f
+++ test/extra/bash_completion/complete_propagate.exp	779304f72ffc9d0b12a87253f81a7e7bbf467468
@@ -1,26 +1,38 @@
-set CTRLC \003
-set timeout 2
+send_user "\n===== BEGIN complete_propagate  =====\n"
+expect -re "@ $"
+send_user "\n===== Testing for the 'propagate' command =====\n"
+send "\n$mtn propagate "
+expect {
+    -ex " propagate " {}
+    timeout { failure "' propagate '"; exit }
+}
 
-send "$mtn propagate \t\t"
-expect "mtn propagate"
+send "\t"
 expect {
-    -ex "prop-br1" {
-	expect {
-	    -ex "prop-bra2" {
-	    }
-	}
-    }
-    timeout { failure; exit }
+    -ex "prop-br1" {}
+    timeout { failure "'prop-bra1'"; exit }
 }
+expect {
+    -ex "prop-bra2" {}
+    timeout { failure "'prop-bra2'"; exit }
+}
 
-send "$CTRLC\n\n"
+send "\003\n"
 
+expect -re "@ $"
+send_user "\n===== Testing that the 'propagate' completes the second branch correctly =====\n"
 # One \t is enough for the second branch name to expand
-send "$mtn propagate prop-br1 prop-bra\t"
+send "\n$mtn propagate prop-br1 prop-bra"
 expect {
-    -ex "prop-bra2" {
-	success
-    }
-    timeout { failure; exit }
+    -ex " propagate " {}
+    timeout { failure "' propagate '"; exit }
 }
-failure
+
+send "\t"
+expect {
+    -ex "prop-bra2" {}
+    timeout { failure "'prop-bra2'"; exit }
+}
+
+send_user "\n===== END complete_propagate  =====\n"
+success
============================================================
--- test/extra/bash_completion/library.exp	5e1a1081c1ebc852cb691c535abe426234ae679b
+++ test/extra/bash_completion/library.exp	fe2bdcd48b3dae04cf4863d11bccb42b98ad01d5
@@ -4,25 +4,25 @@ proc success {} {
     send_user "\n<<success>>\n"
 }
 
-proc failure {} {
-    send_user "\n<<failure>>\n"
+proc failure {str} {
+    if {$str == ""} {
+	send_user "\n<<failure>>\n"
+    } else {
+	send_user "\n<<failure when expecting $str>>\n"
+    }
 }
 
-send_user "mtn = $mtn\n"
-send_user "initial_dir = $initial_dir\n"
-send_user "PATH = $env(PATH)\n"
-spawn "bash" "-l"
-send "export PS1='@ '\n"
-send "export PS2='_@ '\n"
-send "pwd\n"
-# For some reason, it seems bash doesn't load the bash completion package,
-# even though started with -l...
-send ". /etc/bash_completion\n"
+set timeout 2
+set env(initial_dir) $initial_dir
+set env(srcdir) $srcdir
+spawn "bash" "--rcfile" "$srcdir/extra/bash_completion/bashrc"
+# If there is no completion package, it's no point trying this.
 expect {
     -timeout 1
-    "bash: /etc/bash_completion: " { failure; exit }
+    "No bash completion package present." {
+	failure "No bash completion package present."; exit
+    }
 }
 send ". $initial_dir/extra/shell/monotone.bash_completion\n"
 # Wait for the last line to be echoed
 expect "shell/monotone.bash_completion"
-#stty rows 512
============================================================
--- /dev/null	
+++ test/extra/bash_completion/bashrc	50253c70d06f889a476b8333d5013c5512a1ef57
@@ -0,0 +1,30 @@
+# -*- shell-script -*-
+# Use emacs key bindings
+set -o emacs
+# Use bash strict mode
+#set -o posix
+# Set the prompts
+export PS1='@ '
+export PS2='> '
+# Configure readline
+export INPUTRC=$srcdir/extra/bash_completion/inputrc
+# Set dumb terminal
+#export TERM=dummy
+# Give us many columns
+stty columns 4000
+# Make sure to load the bash_completion package
+if [ "$BASH_COMPLETION" = "" ]; then
+    if [ -f /etc/bash_completion ]; then
+	. /etc/bash_completion
+    elif [ -f /usr/local/etc/bash_completion ]; then
+	. /usr/local/etc/bash_completion
+    else
+	echo No bash completion package present.
+	exit
+    fi
+fi
+#
+echo Current settings
+echo pwd: $(pwd)
+echo initial_dir: $initial_dir
+echo srcdir: $srcdir
============================================================
--- /dev/null	
+++ test/extra/bash_completion/inputrc	c8c7098b3ff90813e2877a5cef51dedd73c9c0f8
@@ -0,0 +1,8 @@
+# Press TAB once to autocomplete
+set show-all-if-ambiguous on
+# No bell.  No ^G in output
+set bell-style none
+# Don't query user about viewing the number of possible completions
+set completion-query-items -1
+# Don't use pager when showing completions
+set page-completions off

reply via email to

[Prev in Thread] Current Thread [Next in Thread]