Mercurial > hg
diff tests/test-ui-config.py @ 32449:0ed730f3301c
ui: fix ui.configdate for invalid dates
a7dce526c462 introduced util._parsedate with the aim to be used in
ui.configdate but ui.configdate was using util.parsedate instead. It have the
impact of raising an AbortError in case of an invalid date instead of a
ConfigError exception. Fix ui.configdate to use the right function and add a
test for invalid dates.
Thanks to Yuya for the catch!
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Tue, 23 May 2017 15:44:50 +0200 |
parents | d83ca854fa21 |
children | 85a2db47ad50 |
line wrap: on
line diff
--- a/tests/test-ui-config.py Fri Apr 28 00:01:22 2017 +0900 +++ b/tests/test-ui-config.py Tue May 23 15:44:50 2017 +0200 @@ -32,6 +32,9 @@ 'lists.list16="longer quotation" with "no ending quotation', 'lists.list17=this is \\" "not a quotation mark"', 'lists.list18=\n \n\nding\ndong', + 'date.epoch=0 0', + 'date.birth=2005-04-19T00:00:00', + 'date.invalid=0' ]) print(repr(testui.configitems('values'))) @@ -82,6 +85,9 @@ print(repr(testui.configlist('lists', 'unknown', 'foo, bar'))) print(repr(testui.configlist('lists', 'unknown', ['foo bar']))) print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))) +print("---") +print(repr(testui.configdate('date', 'epoch'))) +print(repr(testui.configdate('date', 'birth'))) print(repr(testui.config('values', 'String'))) @@ -101,3 +107,7 @@ testui.configint('values', 'intinvalid') except error.ConfigError: print('intinvalid') +try: + testui.configdate('date', 'invalid') +except error.ConfigError: + print('dateinvalid')