Mercurial > hg
annotate tests/test-ui-config @ 3749:f9567a7fa3b3
additional fixes for issue436
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Fri, 01 Dec 2006 16:18:16 -0200 |
parents | 1700a103458e |
children | 3fef134832d8 |
rev | line source |
---|---|
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
3346
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3073
diff
changeset
|
3 from mercurial import ui, util, commands |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 testui = ui.ui() |
3346
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3073
diff
changeset
|
6 parsed = commands.parseconfig([ |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 'values.string=string value', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 'values.bool1=true', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 'values.bool2=false', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 'lists.list1=foo', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 'lists.list2=foo bar baz', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 'lists.list3=alice, bob', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 'lists.list4=foo bar baz alice, bob', |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
14 'interpolation.value1=hallo', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
15 'interpolation.value2=%(value1)s world', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
16 'interpolation.value3=%(novalue)s', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
17 'interpolation.value4=%(bad)1', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
18 'interpolation.value5=%bad2', |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 ]) |
3346
1700a103458e
move the parsing of --config options to commands.py
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
3073
diff
changeset
|
20 testui.updateopts(config=parsed) |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 print repr(testui.configitems('values')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
23 print repr(testui.configitems('lists')) |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
24 try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
25 print repr(testui.configitems('interpolation')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
26 except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
27 print inst |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
28 print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
29 print repr(testui.config('values', 'string')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
30 print repr(testui.config('values', 'bool1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
31 print repr(testui.config('values', 'bool2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
32 print repr(testui.config('values', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
33 print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
34 try: |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
35 print repr(testui.configbool('values', 'string')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
36 except ValueError, why: |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
37 print why |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
38 print repr(testui.configbool('values', 'bool1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
39 print repr(testui.configbool('values', 'bool2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
40 print repr(testui.configbool('values', 'bool2', True)) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
41 print repr(testui.configbool('values', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
42 print repr(testui.configbool('values', 'unknown', True)) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
43 print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 print repr(testui.configlist('lists', 'list1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
45 print repr(testui.configlist('lists', 'list2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
46 print repr(testui.configlist('lists', 'list3')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
47 print repr(testui.configlist('lists', 'list4')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
48 print repr(testui.configlist('lists', 'list4', ['foo'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
49 print repr(testui.configlist('lists', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
50 print repr(testui.configlist('lists', 'unknown', '')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
51 print repr(testui.configlist('lists', 'unknown', 'foo')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
52 print repr(testui.configlist('lists', 'unknown', ['foo'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
53 print repr(testui.configlist('lists', 'unknown', 'foo bar')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
54 print repr(testui.configlist('lists', 'unknown', 'foo, bar')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
55 print repr(testui.configlist('lists', 'unknown', ['foo bar'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
56 print repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
57 print "---" |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
58 print repr(testui.config('interpolation', 'value1')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
59 print repr(testui.config('interpolation', 'value2')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
60 try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
61 print repr(testui.config('interpolation', 'value3')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
62 except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
63 print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
64 try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
65 print repr(testui.config('interpolation', 'value4')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
66 except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
67 print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
68 try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
69 print repr(testui.config('interpolation', 'value5')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
70 except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
71 print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
72 print "---" |