##// END OF EJS Templates
tests: make doctests not depend on str(ParseError()) format...
Martin von Zweigbergk -
r46498:18489e26 default
parent child Browse files
Show More
@@ -558,14 +558,22 b' def _parsewith(spec, lookup=None, symini'
558
558
559 >>> _parsewith(b'foo($1)', syminitletters=_aliassyminitletters)
559 >>> _parsewith(b'foo($1)', syminitletters=_aliassyminitletters)
560 ('func', ('symbol', 'foo'), ('symbol', '$1'))
560 ('func', ('symbol', 'foo'), ('symbol', '$1'))
561 >>> _parsewith(b'$1')
561 >>> from . import error
562 Traceback (most recent call last):
562 >>> from . import pycompat
563 ...
563 >>> try:
564 ParseError: ("syntax error in revset '$1'", 0)
564 ... _parsewith(b'$1')
565 >>> _parsewith(b'foo bar')
565 ... except error.ParseError as e:
566 Traceback (most recent call last):
566 ... pycompat.sysstr(e.message)
567 ...
567 ... e.location
568 ParseError: ('invalid token', 4)
568 "syntax error in revset '$1'"
569 0
570 >>> try:
571 ... _parsewith(b'foo bar')
572 ... except error.ParseError as e:
573 ... pycompat.sysstr(e.message)
574 ... e.location
575 'invalid token'
576 4
569 """
577 """
570 if lookup and spec.startswith(b'revset(') and spec.endswith(b')'):
578 if lookup and spec.startswith(b'revset(') and spec.endswith(b')'):
571 lookup = None
579 lookup = None
@@ -376,14 +376,22 b' def parseexpr(expr):'
376 ('string', 'foo')
376 ('string', 'foo')
377 >>> parseexpr(b'foo(bar)')
377 >>> parseexpr(b'foo(bar)')
378 ('func', ('symbol', 'foo'), ('symbol', 'bar'))
378 ('func', ('symbol', 'foo'), ('symbol', 'bar'))
379 >>> parseexpr(b'foo(')
379 >>> from . import error
380 Traceback (most recent call last):
380 >>> from . import pycompat
381 ...
381 >>> try:
382 ParseError: ('not a prefix: end', 4)
382 ... parseexpr(b'foo(')
383 >>> parseexpr(b'"foo" "bar"')
383 ... except error.ParseError as e:
384 Traceback (most recent call last):
384 ... pycompat.sysstr(e.message)
385 ...
385 ... e.location
386 ParseError: ('invalid token', 7)
386 'not a prefix: end'
387 4
388 >>> try:
389 ... parseexpr(b'"foo" "bar"')
390 ... except error.ParseError as e:
391 ... pycompat.sysstr(e.message)
392 ... e.location
393 'invalid token'
394 7
387 """
395 """
388 try:
396 try:
389 return _parseexpr(expr)
397 return _parseexpr(expr)
General Comments 0
You need to be logged in to leave comments. Login now