[PATCH] alias: add test cases for $ escaping in shell aliases
Steve Losh
steve at stevelosh.com
Thu Feb 17 22:19:09 UTC 2011
# HG changeset patch
# User Steve Losh <steve at stevelosh.com>
# Date 1297980932 18000
# Branch stable
# Node ID b5cc838dd999da5dd262536475a336a7e1ab5c53
# Parent 0b1bbc46516ea3a022f5b9e3893525d7f951b10d
alias: add test cases for $ escaping in shell aliases
diff --git a/tests/test-alias.t b/tests/test-alias.t
--- a/tests/test-alias.t
+++ b/tests/test-alias.t
@@ -1,5 +1,6 @@
+ $ HGFOO=BAR; export HGFOO
$ cat >> $HGRCPATH <<EOF
> [extensions]
> graphlog=
>
> [alias]
@@ -32,10 +33,14 @@
> idalias = id
> idaliaslong = id
> idaliasshell = !echo test
> parentsshell1 = !echo one
> parentsshell2 = !echo two
+ > escaped1 = !echo 'test\$\$test'
+ > escaped2 = !echo "HGFOO is \$\$HGFOO"
+ > escaped3 = !echo "\$1 is \$\$\$1"
+ > escaped4 = !echo '\$\$0' '\$\$@'
>
> [defaults]
> mylog = -q
> lognull = -q
> log = -v
@@ -277,10 +282,22 @@
main
$ hg --cwd .. mainalias
main
+shell aliases with escaped $ chars
+
+ $ hg escaped1
+ test$test
+ $ hg escaped2
+ HGFOO is BAR
+ $ hg escaped3 HGFOO
+ HGFOO is BAR
+ $ hg escaped4 test
+ $0 $@
+
+
invalid arguments
$ hg rt foo
hg rt: invalid arguments
hg rt
More information about the Mercurial-devel
mailing list