Mercurial > public > mercurial-scm > hg
diff tests/test-ui-config.py @ 14171:fa2b596db182
ui: add configint function and tests
author | Sune Foldager <cryo@cyanite.org> |
---|---|
date | Tue, 03 May 2011 22:28:08 +0200 |
parents | 4c50552fc9bc |
children | 328739ea70c3 |
line wrap: on
line diff
--- a/tests/test-ui-config.py Sun May 01 13:08:29 2011 -0500 +++ b/tests/test-ui-config.py Tue May 03 22:28:08 2011 +0200 @@ -5,6 +5,10 @@ 'values.string=string value', 'values.bool1=true', 'values.bool2=false', + 'values.boolinvalid=foo', + 'values.int1=42', + 'values.int2=-42', + 'values.intinvalid=foo', 'lists.list1=foo', 'lists.list2=foo bar baz', 'lists.list3=alice, bob', @@ -23,7 +27,7 @@ 'lists.list16="longer quotation" with "no ending quotation', 'lists.list17=this is \\" "not a quotation mark"', 'lists.list18=\n \n\nding\ndong', -]) + ]) print repr(testui.configitems('values')) print repr(testui.configitems('lists')) @@ -43,6 +47,9 @@ print repr(testui.configbool('values', 'unknown')) print repr(testui.configbool('values', 'unknown', True)) print "---" +print repr(testui.configint('values', 'int1')) +print repr(testui.configint('values', 'int2')) +print "---" print repr(testui.configlist('lists', 'list1')) print repr(testui.configlist('lists', 'list2')) print repr(testui.configlist('lists', 'list3')) @@ -79,3 +86,13 @@ # values that aren't strings should work testui.setconfig('hook', 'commit', function) print function == testui.config('hook', 'commit') + +# invalid values +try: + testui.configbool('values', 'boolinvalid') +except error.ConfigError: + print 'boolinvalid' +try: + testui.configint('values', 'intinvalid') +except error.ConfigError: + print 'intinvalid'