Skip to content
Snippets Groups Projects
Commit 629029a466ed authored by Marcin Kasperski's avatar Marcin Kasperski
Browse files

Some more tests, to fine-tune env-dependant behaviour

parent 39ca29db8bc6
No related branches found
No related tags found
No related merge requests found
......@@ -893,6 +893,16 @@
<class 'mercurial.pycompat.bytestr'> <class 'mercurial.pycompat.bytestr'>
b'other' 4
<class 'mercurial.pycompat.bytestr'> <class 'int'>
>>>
>>> for name, value in suffix_config_items(
... ui, b"foo", b'item'):
... print(name, value)
... print(type(name), type(value))
b'some' b'ala, ma kota'
<class 'mercurial.pycompat.bytestr'> <class 'mercurial.pycompat.bytestr'>
b'other' 4
<class 'mercurial.pycompat.bytestr'> <class 'int'>
:param ui: mercurial ui, used to access config
:param section: config section name
......@@ -943,7 +953,7 @@
:return: yields pairs (group-match, value-as-list) for all
matching items, values are boolean
"""
rgxp = re.compile(b'^(\\w+)\\.' + re.escape(pycompat.bytestr(suffix)))
rgxp = re.compile(b'^(\\w+)\\.' + pycompat.bytestr(re.escape(suffix)))
for key, value in rgxp_configlist_items(ui, section, rgxp):
yield key, value
......@@ -980,12 +990,13 @@
b'no' False
>>>
>>> ui.setconfig(b"foo", b"text.item", b"something")
>>> for name, value in suffix_configbool_items(
... ui, "foo", "item"):
... x = (name, str(value))
Traceback (most recent call last):
...
mercurial.error.ConfigError: foo.text.item is not a boolean ('something')
>>> try:
... for name, value in suffix_configbool_items(ui, "foo", "item"):
... x = (name, str(value))
... print("Strange, no error")
... except Exception as err:
... print("OK, error {0}: {1}".format(type(err).__name__, str(err)))
OK, error ConfigError: foo.text.item is not a boolean ('something')
:param ui: mercurial ui, used to access config
:param section: config section name
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment