##// END OF EJS Templates
merge with default to begin 4.6 freeze...
merge with default to begin 4.6 freeze # no-check-commit because of many vendored packages

File last commit:

r37537:3740d1ab default
r37806:ed5448ed merge 4.6rc0 stable
Show More
test-ui-config.py
122 lines | 4.4 KiB | text/x-python | PythonLexer
/ tests / test-ui-config.py
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 from __future__ import absolute_import, print_function
Pulkit Goyal
py3: make test-ui-config use absolute_import
r28680 from mercurial import (
dispatch,
error,
Yuya Nishihara
tests: alias ui as uimod in test-ui-config
r28776 ui as uimod,
Pulkit Goyal
py3: make test-ui-config use absolute_import
r28680 )
Martin Geisler
tests: renamed Python tests to .py
r8449
Yuya Nishihara
ui: factor out ui.load() to create a ui without loading configs (API)...
r30559 testui = uimod.ui.load()
Boris Feld
configitems: adds a developer warning when accessing undeclared configuration...
r34859
# disable the configuration registration warning
#
# the purpose of this test is to check the old behavior, not to validate the
# behavior from registered item. so we silent warning related to unregisted
# config.
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.setconfig(b'devel', b'warn-config-unknown', False, b'test')
testui.setconfig(b'devel', b'all-warnings', False, b'test')
Boris Feld
configitems: adds a developer warning when accessing undeclared configuration...
r34859
Martin Geisler
tests: renamed Python tests to .py
r8449 parsed = dispatch._parseconfig(testui, [
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 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'
Sune Foldager
ui: add configint function and tests
r14171 ])
Martin Geisler
tests: renamed Python tests to .py
r8449
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configitems(b'values')))
print(repr(testui.configitems(b'lists')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.config(b'values', b'string')))
print(repr(testui.config(b'values', b'bool1')))
print(repr(testui.config(b'values', b'bool2')))
print(repr(testui.config(b'values', b'unknown')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Martin Geisler
tests: renamed Python tests to .py
r8449 try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configbool(b'values', b'string')))
Gregory Szorc
global: mass rewrite to use modern exception syntax...
r25660 except error.ConfigError as inst:
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print(inst)
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configbool(b'values', b'bool1')))
print(repr(testui.configbool(b'values', b'bool2')))
print(repr(testui.configbool(b'values', b'bool2', True)))
print(repr(testui.configbool(b'values', b'unknown')))
print(repr(testui.configbool(b'values', b'unknown', True)))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configint(b'values', b'int1')))
print(repr(testui.configint(b'values', b'int2')))
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print("---")
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configlist(b'lists', b'list1')))
print(repr(testui.configlist(b'lists', b'list2')))
print(repr(testui.configlist(b'lists', b'list3')))
print(repr(testui.configlist(b'lists', b'list4')))
print(repr(testui.configlist(b'lists', b'list4', [b'foo'])))
print(repr(testui.configlist(b'lists', b'list5')))
print(repr(testui.configlist(b'lists', b'list6')))
print(repr(testui.configlist(b'lists', b'list7')))
print(repr(testui.configlist(b'lists', b'list8')))
print(repr(testui.configlist(b'lists', b'list9')))
print(repr(testui.configlist(b'lists', b'list10')))
print(repr(testui.configlist(b'lists', b'list11')))
print(repr(testui.configlist(b'lists', b'list12')))
print(repr(testui.configlist(b'lists', b'list13')))
print(repr(testui.configlist(b'lists', b'list14')))
print(repr(testui.configlist(b'lists', b'list15')))
print(repr(testui.configlist(b'lists', b'list16')))
print(repr(testui.configlist(b'lists', b'list17')))
print(repr(testui.configlist(b'lists', b'list18')))
print(repr(testui.configlist(b'lists', b'unknown')))
print(repr(testui.configlist(b'lists', b'unknown', b'')))
print(repr(testui.configlist(b'lists', b'unknown', b'foo')))
print(repr(testui.configlist(b'lists', b'unknown', [b'foo'])))
print(repr(testui.configlist(b'lists', b'unknown', b'foo bar')))
print(repr(testui.configlist(b'lists', b'unknown', b'foo, bar')))
print(repr(testui.configlist(b'lists', b'unknown', [b'foo bar'])))
print(repr(testui.configlist(b'lists', b'unknown', [b'foo', b'bar'])))
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 print("---")
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.configdate(b'date', b'epoch')))
print(repr(testui.configdate(b'date', b'birth')))
Martin Geisler
tests: renamed Python tests to .py
r8449
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 print(repr(testui.config(b'values', b'String')))
Martin Geisler
tests: renamed Python tests to .py
r8449
def function():
pass
# values that aren't strings should work
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.setconfig(b'hook', b'commit', function)
print(function == testui.config(b'hook', b'commit'))
Sune Foldager
ui: add configint function and tests
r14171
# invalid values
try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configbool(b'values', b'boolinvalid')
Sune Foldager
ui: add configint function and tests
r14171 except error.ConfigError:
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print('boolinvalid')
Sune Foldager
ui: add configint function and tests
r14171 try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configint(b'values', b'intinvalid')
Sune Foldager
ui: add configint function and tests
r14171 except error.ConfigError:
Pulkit Goyal
py3: make test-ui-config use print_function
r28681 print('intinvalid')
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 try:
Pulkit Goyal
py3: add b'' prefixes in tests/test-ui-config.py...
r37537 testui.configdate(b'date', b'invalid')
Boris Feld
ui: fix ui.configdate for invalid dates...
r32449 except error.ConfigError:
print('dateinvalid')