diff tests/test-revset.t @ 14723:b9faf94ee196 stable

revset: fix aliases with 0 or more than 2 parameters The existing code seemed to have incorrect assumptions about how parameter lists are represented by the parser. Now the match and replace functions have been merged and simplified by using getlist().
author Mads Kiilerich <mads@kiilerich.com>
date Wed, 22 Jun 2011 01:55:00 +0200
parents 93731b3efd0d
children 8b84d040d9f9 41885892796e
line wrap: on
line diff
--- a/tests/test-revset.t	Thu Jun 23 14:40:57 2011 +0200
+++ b/tests/test-revset.t	Wed Jun 22 01:55:00 2011 +0200
@@ -420,6 +420,7 @@
   $ echo 'm = merge()' >> .hg/hgrc
   $ echo 'd($1) = reverse(sort($1, date))' >> .hg/hgrc
   $ echo 'rs(ARG1, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
+  $ echo 'rs4(ARG1, ARGA, ARGB, ARG2) = reverse(sort(ARG1, ARG2))' >> .hg/hgrc
 
   $ try m
   ('symbol', 'm')
@@ -437,6 +438,23 @@
   ('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or', ('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
   3
   2
+  $ try 'rs()'
+  ('func', ('symbol', 'rs'), None)
+  hg: parse error: invalid number of arguments: 0
+  [255]
+  $ try 'rs(2)'
+  ('func', ('symbol', 'rs'), ('symbol', '2'))
+  hg: parse error: invalid number of arguments: 1
+  [255]
+  $ try 'rs(2, data, 7)'
+  ('func', ('symbol', 'rs'), ('list', ('list', ('symbol', '2'), ('symbol', 'data')), ('symbol', '7')))
+  hg: parse error: invalid number of arguments: 3
+  [255]
+  $ try 'rs4(2 or 3, x, x, date)'
+  ('func', ('symbol', 'rs4'), ('list', ('list', ('list', ('or', ('symbol', '2'), ('symbol', '3')), ('symbol', 'x')), ('symbol', 'x')), ('symbol', 'date')))
+  ('func', ('symbol', 'reverse'), ('func', ('symbol', 'sort'), ('list', ('or', ('symbol', '2'), ('symbol', '3')), ('symbol', 'date'))))
+  3
+  2
 
 issue2549 - correct optimizations