Mercurial > hg > mercurial-source
comparison tests/test-ui-config.py @ 33232: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 |
comparison
equal
deleted
inserted
replaced
33231:91a2ec8e7fa0 | 33232:0ed730f3301c |
---|---|
30 'lists.list14=,,,, ', | 30 'lists.list14=,,,, ', |
31 'lists.list15=" just with starting quotation', | 31 'lists.list15=" just with starting quotation', |
32 'lists.list16="longer quotation" with "no ending quotation', | 32 'lists.list16="longer quotation" with "no ending quotation', |
33 'lists.list17=this is \\" "not a quotation mark"', | 33 'lists.list17=this is \\" "not a quotation mark"', |
34 'lists.list18=\n \n\nding\ndong', | 34 'lists.list18=\n \n\nding\ndong', |
35 'date.epoch=0 0', | |
36 'date.birth=2005-04-19T00:00:00', | |
37 'date.invalid=0' | |
35 ]) | 38 ]) |
36 | 39 |
37 print(repr(testui.configitems('values'))) | 40 print(repr(testui.configitems('values'))) |
38 print(repr(testui.configitems('lists'))) | 41 print(repr(testui.configitems('lists'))) |
39 print("---") | 42 print("---") |
80 print(repr(testui.configlist('lists', 'unknown', ['foo']))) | 83 print(repr(testui.configlist('lists', 'unknown', ['foo']))) |
81 print(repr(testui.configlist('lists', 'unknown', 'foo bar'))) | 84 print(repr(testui.configlist('lists', 'unknown', 'foo bar'))) |
82 print(repr(testui.configlist('lists', 'unknown', 'foo, bar'))) | 85 print(repr(testui.configlist('lists', 'unknown', 'foo, bar'))) |
83 print(repr(testui.configlist('lists', 'unknown', ['foo bar']))) | 86 print(repr(testui.configlist('lists', 'unknown', ['foo bar']))) |
84 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))) | 87 print(repr(testui.configlist('lists', 'unknown', ['foo', 'bar']))) |
88 print("---") | |
89 print(repr(testui.configdate('date', 'epoch'))) | |
90 print(repr(testui.configdate('date', 'birth'))) | |
85 | 91 |
86 print(repr(testui.config('values', 'String'))) | 92 print(repr(testui.config('values', 'String'))) |
87 | 93 |
88 def function(): | 94 def function(): |
89 pass | 95 pass |
99 print('boolinvalid') | 105 print('boolinvalid') |
100 try: | 106 try: |
101 testui.configint('values', 'intinvalid') | 107 testui.configint('values', 'intinvalid') |
102 except error.ConfigError: | 108 except error.ConfigError: |
103 print('intinvalid') | 109 print('intinvalid') |
110 try: | |
111 testui.configdate('date', 'invalid') | |
112 except error.ConfigError: | |
113 print('dateinvalid') |