test-mq-subrepo.t: correctly forward stdin to test functions
- stdin was not forwarded in testrm1 and testrm2
- Forwarding content with EOL using command substitution (`foo`) does not work
correctly, the lines are joined together which breaks the prompt readline.
- EOFError is raised in ui.prompt() if the input is too short on Linux while
OSX treats it as an empty line.
--- a/tests/test-mq-subrepo.t Thu Jan 06 17:04:47 2011 -0600
+++ b/tests/test-mq-subrepo.t Fri Jan 07 17:44:23 2011 +0100
@@ -4,6 +4,8 @@
$ echo "[diff]" >> $HGRCPATH
$ echo "nodates=1" >> $HGRCPATH
+ $ stdin=`pwd`/stdin.tmp
+
fn to create new repository w/dirty subrepo, and cd into it
$ mkrepo() {
> hg init $1
@@ -21,41 +23,42 @@
> }
$ testadd() {
- > local stdin=`cat`
+ > cat - > "$stdin"
> mksubrepo sub
> echo sub = sub >> .hgsub
> hg add .hgsub
> echo % abort when adding .hgsub w/dirty subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> echo [$?]
> hg -R sub ci -m0sub
> echo % update substate when adding .hgsub w/clean updated subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> hg debugsub
> }
$ testmod() {
- > local stdin=`cat`
+ > cat - > "$stdin"
> mksubrepo sub2
> echo sub2 = sub2 >> .hgsub
> echo % abort when modifying .hgsub w/dirty subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> echo [$?]
> hg -R sub2 ci -m0sub2
> echo % update substate when modifying .hgsub w/clean updated subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> hg debugsub
> }
$ testrm1() {
+ > cat - > "$stdin"
> mksubrepo sub3
> echo sub3 = sub3 >> .hgsub
> hg ci -Aqmsub3
@@ -65,11 +68,13 @@
> echo % update substate when removing .hgsub w/dirty subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> echo % debugsub should be empty
> hg debugsub
> }
+
$ testrm2() {
+ > cat - > "$stdin"
> mksubrepo sub4
> echo sub4 = sub4 >> .hgsub
> hg ci -Aqmsub4
@@ -78,7 +83,7 @@
> echo % update substate when removing .hgsub w/clean updated subrepo
> hg status -S
> echo '%' $*
- > echo "$stdin" | hg $*
+ > cat "$stdin" | hg $*
> echo % debugsub should be empty
> hg debugsub
> }