changeset 13434:b5cc838dd999 stable

alias: add test cases for $ escaping in shell aliases
author Steve Losh <steve@stevelosh.com>
date Thu, 17 Feb 2011 17:15:32 -0500
parents 0b1bbc46516e
children 90d7ce986565
files tests/test-alias.t
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-alias.t	Wed Feb 16 17:36:31 2011 -0600
+++ b/tests/test-alias.t	Thu Feb 17 17:15:32 2011 -0500
@@ -1,3 +1,4 @@
+  $ HGFOO=BAR; export HGFOO
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > graphlog=
@@ -34,6 +35,10 @@
   > 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
@@ -279,6 +284,18 @@
   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