tests/misc.py

changeset 47
4da025d0b283
parent 38
66c9591b733d
child 48
38b0919c1934
equal deleted inserted replaced
39:abc83875167e 47:4da025d0b283
14 error(element, 'syntax-error', reason = element.reason) 14 error(element, 'syntax-error', reason = element.reason)
15 for element in model.body 15 for element in model.body
16 if isinstance(element, linetypes.Error) 16 if isinstance(element, linetypes.Error)
17 ) 17 )
18 18
19 def bad_header(model):
20 import header
21 if isinstance(model.header, header.BadHeader):
22 yield error(
23 model.body[model.header.index],
24 'bad-header',
25 reason = model.header.reason,
26 )
27
19 manifest = { 28 manifest = {
20 'tests': { 29 'tests': {
21 'colour-validity': colours_test, 30 'colour-validity': colours_test,
22 'syntax-errors': syntax_errors, 31 'syntax-errors': syntax_errors,
32 'header-validity': bad_header,
23 }, 33 },
24 'messages': { 34 'messages': {
25 'bad-colour': lambda colour_index: str.format( 35 'bad-colour': lambda colour_index: str.format(
26 'invalid colour {}', 36 'invalid colour {}',
27 colour_index, 37 colour_index,
28 ), 38 ),
29 'syntax-error': lambda reason: str.format( 39 'syntax-error': lambda reason: str.format(
30 'syntax error: {}', 40 'syntax error: {}',
31 reason, 41 reason,
32 ), 42 ),
43 'bad-header': lambda reason: str.format(
44 'bad header: {}',
45 reason,
46 ),
33 }, 47 },
34 } 48 }

mercurial