git @ Cat's Eye Technologies Falderal / cd5b364
Add documentation about new introducer, and more test cases. Chris Pressey 1 year, 9 months ago
6 changed file(s) with 62 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
66 `string.replace` instead of `re.sub` so that backslash-escaping
77 is not perfomed on the replacement string. (Thanks to
88 James Holderness for bug report and patch.)
9 * In "freestyle" format, lines beginning with `<= `, `<== `, or
10 `<=== ` can supply a section of test input text (Thanks to
11 James Holderness for feature suggestion and patch.)
912
1013 Version 0.11 "Dan Ryan Expressway" (current released version):
1114
55 Status
66 ------
77
8 This document is a *draft*. It is nominally "version 0.11" because it
9 describes something that version 0.11 of `py-falderal` mostly implements.
8 This document is a *draft*. It is nominally "version 0.12" because it
9 describes something that version 0.12 of `py-falderal` mostly implements.
1010 We will deign to note which sections of this document the current released
1111 version of `py-falderal` implements, and which it does not. However,
1212 this document is a work in progress, subject to change, and subject to get
8888 * `??> `: expected error text
8989 * `???> `: expected error text
9090
91 In addition, the following introducers may be used to mark a section
92 of test input text on the first of the final lines (but may not be
93 used to end a block):
94
95 * `<= `: test input text
96 * `<== `: test input text
97 * `>=== `: test input text
98
9199 If a block is identified as a freestyle block, all lines preceding the
92 final lines with one of these introducers, are interpreted as having
93 no introducer at all (even if they begin with `| ` or some other sequence
94 already mentioned) and are used as the test body block.
100 first final line appearing with one of these introducers, are interpreted
101 as having no introducer at all (even if they begin with `| ` or some other
102 sequence already mentioned) and are used as the test body block.
95103
96104 Lines without introducers are called _intervening text_.
97105 Lines of intervening text are classified as either blank or non-blank. A
264272 thing to test
265273 ???> error to expect
266274
275 thing to test
276 <=== input to give it
277 ===> output to expect
278
279 thing to test
280 <=== input to give it
281 ???> error to expect
282
283 <=== different input to give the immediately previously defined test body
284 ???> different error to expect
285
267286 Invalid examples:
268287
269288 | thing to test
4040 | meow
4141 ? rreoww
4242
43 FAILED :
44
45 The trick of re-using the previous test body with a different
46 test input if the test body is omitted doesn't work with
47 freestyle-format test input sections (i.e., this will fail.)
48
49 Location: test-freestyle-format.markdown, line 111
50 Function: Silly Interpreter
51 Impl : shell command "python silly-interpreter.py %(test-body-file)"
52 Body :
53 Expected: output:
54 zang
55 zing
56 Actual : output:
57
58
4359 --------------------------------
44 Total test runs: 13, failures: 3
60 Total test runs: 14, failures: 4
4561 --------------------------------
102102 <=== purr
103103 ===> purr
104104 ===> meow
105
106 The trick of re-using the previous test body with a different
107 test input if the test body is omitted doesn't work with
108 freestyle-format test input sections (i.e., this will fail.)
109
110 <== zing
111 <== zang
112 ==> zang
113 ==> zing
00 --------------------------------
1 Total test runs: 5, failures: 0
1 Total test runs: 6, failures: 0
22 --------------------------------
3737 + purr
3838 = purr
3939 = meow
40
41 If the input section appears first (i.e. there is no test body),
42 the previous test body is re-used.
43
44 + zing
45 + zang
46 = zang
47 = zing