tests/test-alias.t
changeset 34484 a8a9c0d3232b
parent 29974 7109d5ddeb0c
child 35225 7ce0ba3a1c32
--- a/tests/test-alias.t	Wed Oct 04 18:39:26 2017 -0700
+++ b/tests/test-alias.t	Mon Oct 02 16:48:58 2017 -0700
@@ -527,21 +527,29 @@
 
 environment variable changes in alias commands
 
-  $ cat > $TESTTMP/setcount.py <<EOF
+  $ cat > $TESTTMP/expandalias.py <<EOF
   > import os
-  > def uisetup(ui):
+  > from mercurial import cmdutil, commands, registrar
+  > cmdtable = {}
+  > command = registrar.command(cmdtable)
+  > @command('expandalias')
+  > def expandalias(ui, repo, name):
+  >     alias = cmdutil.findcmd(name, commands.table)[1][0]
+  >     ui.write('%s args: %s\n' % (name, ' '.join(alias.args)))
   >     os.environ['COUNT'] = '2'
+  >     ui.write('%s args: %s (with COUNT=2)\n' % (name, ' '.join(alias.args)))
   > EOF
 
   $ cat >> $HGRCPATH <<'EOF'
   > [extensions]
-  > setcount = $TESTTMP/setcount.py
+  > expandalias = $TESTTMP/expandalias.py
   > [alias]
-  > showcount = log -T "$COUNT\n" -r .
+  > showcount = log -T "$COUNT" -r .
   > EOF
 
-  $ COUNT=1 hg showcount
-  2
+  $ COUNT=1 hg expandalias showcount
+  showcount args: -T 1 -r .
+  showcount args: -T 2 -r . (with COUNT=2)
 
 This should show id: