--- a/tests/test-ui-config.py Sat Oct 05 10:29:34 2019 -0400
+++ b/tests/test-ui-config.py Sun Oct 06 09:45:02 2019 -0400
@@ -5,9 +5,7 @@
pycompat,
ui as uimod,
)
-from mercurial.utils import (
- stringutil,
-)
+from mercurial.utils import stringutil
testui = uimod.ui.load()
@@ -19,40 +17,45 @@
testui.setconfig(b'devel', b'warn-config-unknown', False, b'test')
testui.setconfig(b'devel', b'all-warnings', False, b'test')
-parsed = dispatch._parseconfig(testui, [
- b'values.string=string value',
- b'values.bool1=true',
- b'values.bool2=false',
- b'values.boolinvalid=foo',
- b'values.int1=42',
- b'values.int2=-42',
- b'values.intinvalid=foo',
- b'lists.list1=foo',
- b'lists.list2=foo bar baz',
- b'lists.list3=alice, bob',
- b'lists.list4=foo bar baz alice, bob',
- b'lists.list5=abc d"ef"g "hij def"',
- b'lists.list6="hello world", "how are you?"',
- b'lists.list7=Do"Not"Separate',
- b'lists.list8="Do"Separate',
- b'lists.list9="Do\\"NotSeparate"',
- b'lists.list10=string "with extraneous" quotation mark"',
- b'lists.list11=x, y',
- b'lists.list12="x", "y"',
- b'lists.list13=""" key = "x", "y" """',
- b'lists.list14=,,,, ',
- b'lists.list15=" just with starting quotation',
- b'lists.list16="longer quotation" with "no ending quotation',
- b'lists.list17=this is \\" "not a quotation mark"',
- b'lists.list18=\n \n\nding\ndong',
- b'date.epoch=0 0',
- b'date.birth=2005-04-19T00:00:00',
- b'date.invalid=0'
- ])
+parsed = dispatch._parseconfig(
+ testui,
+ [
+ b'values.string=string value',
+ b'values.bool1=true',
+ b'values.bool2=false',
+ b'values.boolinvalid=foo',
+ b'values.int1=42',
+ b'values.int2=-42',
+ b'values.intinvalid=foo',
+ b'lists.list1=foo',
+ b'lists.list2=foo bar baz',
+ b'lists.list3=alice, bob',
+ b'lists.list4=foo bar baz alice, bob',
+ b'lists.list5=abc d"ef"g "hij def"',
+ b'lists.list6="hello world", "how are you?"',
+ b'lists.list7=Do"Not"Separate',
+ b'lists.list8="Do"Separate',
+ b'lists.list9="Do\\"NotSeparate"',
+ b'lists.list10=string "with extraneous" quotation mark"',
+ b'lists.list11=x, y',
+ b'lists.list12="x", "y"',
+ b'lists.list13=""" key = "x", "y" """',
+ b'lists.list14=,,,, ',
+ b'lists.list15=" just with starting quotation',
+ b'lists.list16="longer quotation" with "no ending quotation',
+ b'lists.list17=this is \\" "not a quotation mark"',
+ b'lists.list18=\n \n\nding\ndong',
+ b'date.epoch=0 0',
+ b'date.birth=2005-04-19T00:00:00',
+ b'date.invalid=0',
+ ],
+)
+
def pprint(obj):
return stringutil.pprint(obj).decode('ascii')
+
print(pprint(testui.configitems(b'values')))
print(pprint(testui.configitems(b'lists')))
print("---")
@@ -107,9 +110,11 @@
print(pprint(testui.config(b'values', b'String')))
+
def function():
pass
+
# values that aren't strings should work
testui.setconfig(b'hook', b'commit', function)
print(function == testui.config(b'hook', b'commit'))