##// END OF EJS Templates
test-minirst: don't test on invalid reST input...
Martin Geisler -
r9736:26d3ade6 default
parent child Browse files
Show More
@@ -1,153 +1,138 b''
1 #!/usr/bin/env python
1 #!/usr/bin/env python
2
2
3 from mercurial import minirst
3 from mercurial import minirst
4
4
5 def debugformat(title, text, width):
5 def debugformat(title, text, width):
6 print "%s formatted to fit within %d characters:" % (title, width)
6 print "%s formatted to fit within %d characters:" % (title, width)
7 print "-" * 70
7 print "-" * 70
8 print minirst.format(text, width)
8 print minirst.format(text, width)
9 print "-" * 70
9 print "-" * 70
10 print
10 print
11
11
12 paragraphs = """
12 paragraphs = """
13 This is some text in the first paragraph.
13 This is some text in the first paragraph.
14
14
15 An indented paragraph
15 A small indented paragraph.
16 with just two lines.
16 It is followed by some lines
17
17 containing random whitespace.
18
19 The third paragraph. It is followed by some
20 random lines with spurious spaces.
21
18
22
19
23
20
24
21 The third and final paragraph.
25
26 No indention
27 here, despite
28 the uneven left
29 margin.
30
31 Only the
32 left-most line
33 (this line!)
34 is significant
35 for the indentation
36
37 """
22 """
38
23
39 debugformat('paragraphs', paragraphs, 60)
24 debugformat('paragraphs', paragraphs, 60)
40 debugformat('paragraphs', paragraphs, 30)
25 debugformat('paragraphs', paragraphs, 30)
41
26
42
27
43 definitions = """
28 definitions = """
44 A Term
29 A Term
45 Definition. The indented
30 Definition. The indented
46 lines make up the definition.
31 lines make up the definition.
47 Another Term
32 Another Term
48 Another definition. The final line in the
33 Another definition. The final line in the
49 definition determines the indentation, so
34 definition determines the indentation, so
50 this will be indented with four spaces.
35 this will be indented with four spaces.
51
36
52 A Nested/Indented Term
37 A Nested/Indented Term
53 Definition.
38 Definition.
54 """
39 """
55
40
56 debugformat('definitions', definitions, 60)
41 debugformat('definitions', definitions, 60)
57 debugformat('definitions', definitions, 30)
42 debugformat('definitions', definitions, 30)
58
43
59
44
60 literals = r"""
45 literals = r"""
61 The fully minimized form is the most
46 The fully minimized form is the most
62 convenient form::
47 convenient form::
63
48
64 Hello
49 Hello
65 literal
50 literal
66 world
51 world
67
52
68 In the partially minimized form a paragraph
53 In the partially minimized form a paragraph
69 simply ends with space-double-colon. ::
54 simply ends with space-double-colon. ::
70
55
71 ////////////////////////////////////////
56 ////////////////////////////////////////
72 long un-wrapped line in a literal block
57 long un-wrapped line in a literal block
73 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
58 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
74
59
75 ::
60 ::
76
61
77 This literal block is started with '::',
62 This literal block is started with '::',
78 the so-called expanded form. The paragraph
63 the so-called expanded form. The paragraph
79 with '::' disappears in the final output.
64 with '::' disappears in the final output.
80 """
65 """
81
66
82 debugformat('literals', literals, 60)
67 debugformat('literals', literals, 60)
83 debugformat('literals', literals, 30)
68 debugformat('literals', literals, 30)
84
69
85
70
86 lists = """
71 lists = """
87 - This is the first list item.
72 - This is the first list item.
88
73
89 Second paragraph in the first list item.
74 Second paragraph in the first list item.
90
75
91 - List items need not be separated
76 - List items need not be separated
92 by a blank line.
77 by a blank line.
93 - And will be rendered without
78 - And will be rendered without
94 one in any case.
79 one in any case.
95
80
96 We can have indented lists:
81 We can have indented lists:
97
82
98 - This is an indented list item
83 - This is an indented list item
99
84
100 - Another indented list item::
85 - Another indented list item::
101
86
102 - A literal block in the middle
87 - A literal block in the middle
103 of an indented list.
88 of an indented list.
104
89
105 (The above is not a list item since we are in the literal block.)
90 (The above is not a list item since we are in the literal block.)
106
91
107 ::
92 ::
108
93
109 Literal block with no indentation (apart from
94 Literal block with no indentation (apart from
110 the two spaces added to all literal blocks).
95 the two spaces added to all literal blocks).
111 """
96 """
112
97
113 debugformat('lists', lists, 60)
98 debugformat('lists', lists, 60)
114 debugformat('lists', lists, 30)
99 debugformat('lists', lists, 30)
115
100
116
101
117 options = """
102 options = """
118 There is support for simple option lists,
103 There is support for simple option lists,
119 but only with long options:
104 but only with long options:
120
105
121 --all Output all.
106 --all Output all.
122 --both Output both (this description is
107 --both Output both (this description is
123 quite long).
108 quite long).
124 --long Output all day long.
109 --long Output all day long.
125
110
126 --par This option has two paragraphs in its description.
111 --par This option has two paragraphs in its description.
127 This is the first.
112 This is the first.
128
113
129 This is the second. Blank lines may be omitted between
114 This is the second. Blank lines may be omitted between
130 options (as above) or left in (as here).
115 options (as above) or left in (as here).
131
116
132 The next paragraph looks like an option list, but lacks the two-space
117 The next paragraph looks like an option list, but lacks the two-space
133 marker after the option. It is treated as a normal paragraph:
118 marker after the option. It is treated as a normal paragraph:
134
119
135 --foo bar baz
120 --foo bar baz
136 """
121 """
137
122
138 debugformat('options', options, 60)
123 debugformat('options', options, 60)
139 debugformat('options', options, 30)
124 debugformat('options', options, 30)
140
125
141
126
142 fields = """
127 fields = """
143 Field lists give a simple two-column layout:
128 Field lists give a simple two-column layout:
144
129
145 :key: The whitespace following the key is
130 :key: The whitespace following the key is
146 significant for the wrapping of this text.
131 significant for the wrapping of this text.
147 :another key: More text.
132 :another key: More text.
148 The indentation on the following
133 The indentation on the following
149 lines is not significant.
134 lines is not significant.
150 """
135 """
151
136
152 debugformat('fields', fields, 60)
137 debugformat('fields', fields, 60)
153 debugformat('fields', fields, 30)
138 debugformat('fields', fields, 30)
@@ -1,239 +1,227 b''
1 paragraphs formatted to fit within 60 characters:
1 paragraphs formatted to fit within 60 characters:
2 ----------------------------------------------------------------------
2 ----------------------------------------------------------------------
3 This is some text in the first paragraph.
3 This is some text in the first paragraph.
4
4
5 An indented paragraph with just two lines.
5 A small indented paragraph. It is followed by some lines
6
6 containing random whitespace.
7 The third paragraph. It is followed by some random lines
8 with spurious spaces.
9
7
10 No indention here, despite the uneven left margin.
8 The third and final paragraph.
11
12 Only the left-most line (this line!) is significant for
13 the indentation
14 ----------------------------------------------------------------------
9 ----------------------------------------------------------------------
15
10
16 paragraphs formatted to fit within 30 characters:
11 paragraphs formatted to fit within 30 characters:
17 ----------------------------------------------------------------------
12 ----------------------------------------------------------------------
18 This is some text in the first
13 This is some text in the first
19 paragraph.
14 paragraph.
20
15
21 An indented paragraph with
16 A small indented paragraph.
22 just two lines.
17 It is followed by some lines
23
18 containing random
24 The third paragraph. It is
19 whitespace.
25 followed by some random lines
26 with spurious spaces.
27
20
28 No indention here, despite the
21 The third and final paragraph.
29 uneven left margin.
30
31 Only the left-most line
32 (this line!) is significant
33 for the indentation
34 ----------------------------------------------------------------------
22 ----------------------------------------------------------------------
35
23
36 definitions formatted to fit within 60 characters:
24 definitions formatted to fit within 60 characters:
37 ----------------------------------------------------------------------
25 ----------------------------------------------------------------------
38 A Term
26 A Term
39 Definition. The indented lines make up the definition.
27 Definition. The indented lines make up the definition.
40 Another Term
28 Another Term
41 Another definition. The final line in the definition
29 Another definition. The final line in the definition
42 determines the indentation, so this will be indented
30 determines the indentation, so this will be indented
43 with four spaces.
31 with four spaces.
44 A Nested/Indented Term
32 A Nested/Indented Term
45 Definition.
33 Definition.
46 ----------------------------------------------------------------------
34 ----------------------------------------------------------------------
47
35
48 definitions formatted to fit within 30 characters:
36 definitions formatted to fit within 30 characters:
49 ----------------------------------------------------------------------
37 ----------------------------------------------------------------------
50 A Term
38 A Term
51 Definition. The indented
39 Definition. The indented
52 lines make up the
40 lines make up the
53 definition.
41 definition.
54 Another Term
42 Another Term
55 Another definition. The
43 Another definition. The
56 final line in the
44 final line in the
57 definition determines the
45 definition determines the
58 indentation, so this will
46 indentation, so this will
59 be indented with four
47 be indented with four
60 spaces.
48 spaces.
61 A Nested/Indented Term
49 A Nested/Indented Term
62 Definition.
50 Definition.
63 ----------------------------------------------------------------------
51 ----------------------------------------------------------------------
64
52
65 literals formatted to fit within 60 characters:
53 literals formatted to fit within 60 characters:
66 ----------------------------------------------------------------------
54 ----------------------------------------------------------------------
67 The fully minimized form is the most convenient form:
55 The fully minimized form is the most convenient form:
68
56
69 Hello
57 Hello
70 literal
58 literal
71 world
59 world
72
60
73 In the partially minimized form a paragraph simply ends with
61 In the partially minimized form a paragraph simply ends with
74 space-double-colon.
62 space-double-colon.
75
63
76 ////////////////////////////////////////
64 ////////////////////////////////////////
77 long un-wrapped line in a literal block
65 long un-wrapped line in a literal block
78 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
66 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
79
67
80 This literal block is started with '::',
68 This literal block is started with '::',
81 the so-called expanded form. The paragraph
69 the so-called expanded form. The paragraph
82 with '::' disappears in the final output.
70 with '::' disappears in the final output.
83 ----------------------------------------------------------------------
71 ----------------------------------------------------------------------
84
72
85 literals formatted to fit within 30 characters:
73 literals formatted to fit within 30 characters:
86 ----------------------------------------------------------------------
74 ----------------------------------------------------------------------
87 The fully minimized form is
75 The fully minimized form is
88 the most convenient form:
76 the most convenient form:
89
77
90 Hello
78 Hello
91 literal
79 literal
92 world
80 world
93
81
94 In the partially minimized
82 In the partially minimized
95 form a paragraph simply ends
83 form a paragraph simply ends
96 with space-double-colon.
84 with space-double-colon.
97
85
98 ////////////////////////////////////////
86 ////////////////////////////////////////
99 long un-wrapped line in a literal block
87 long un-wrapped line in a literal block
100 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
88 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
101
89
102 This literal block is started with '::',
90 This literal block is started with '::',
103 the so-called expanded form. The paragraph
91 the so-called expanded form. The paragraph
104 with '::' disappears in the final output.
92 with '::' disappears in the final output.
105 ----------------------------------------------------------------------
93 ----------------------------------------------------------------------
106
94
107 lists formatted to fit within 60 characters:
95 lists formatted to fit within 60 characters:
108 ----------------------------------------------------------------------
96 ----------------------------------------------------------------------
109 - This is the first list item.
97 - This is the first list item.
110
98
111 Second paragraph in the first list item.
99 Second paragraph in the first list item.
112
100
113 - List items need not be separated by a blank line.
101 - List items need not be separated by a blank line.
114 - And will be rendered without one in any case.
102 - And will be rendered without one in any case.
115
103
116 We can have indented lists:
104 We can have indented lists:
117
105
118 - This is an indented list item
106 - This is an indented list item
119 - Another indented list item:
107 - Another indented list item:
120
108
121 - A literal block in the middle
109 - A literal block in the middle
122 of an indented list.
110 of an indented list.
123
111
124 (The above is not a list item since we are in the literal block.)
112 (The above is not a list item since we are in the literal block.)
125
113
126 Literal block with no indentation (apart from
114 Literal block with no indentation (apart from
127 the two spaces added to all literal blocks).
115 the two spaces added to all literal blocks).
128 ----------------------------------------------------------------------
116 ----------------------------------------------------------------------
129
117
130 lists formatted to fit within 30 characters:
118 lists formatted to fit within 30 characters:
131 ----------------------------------------------------------------------
119 ----------------------------------------------------------------------
132 - This is the first list item.
120 - This is the first list item.
133
121
134 Second paragraph in the
122 Second paragraph in the
135 first list item.
123 first list item.
136
124
137 - List items need not be
125 - List items need not be
138 separated by a blank line.
126 separated by a blank line.
139 - And will be rendered without
127 - And will be rendered without
140 one in any case.
128 one in any case.
141
129
142 We can have indented lists:
130 We can have indented lists:
143
131
144 - This is an indented list
132 - This is an indented list
145 item
133 item
146 - Another indented list
134 - Another indented list
147 item:
135 item:
148
136
149 - A literal block in the middle
137 - A literal block in the middle
150 of an indented list.
138 of an indented list.
151
139
152 (The above is not a list item since we are in the literal block.)
140 (The above is not a list item since we are in the literal block.)
153
141
154 Literal block with no indentation (apart from
142 Literal block with no indentation (apart from
155 the two spaces added to all literal blocks).
143 the two spaces added to all literal blocks).
156 ----------------------------------------------------------------------
144 ----------------------------------------------------------------------
157
145
158 options formatted to fit within 60 characters:
146 options formatted to fit within 60 characters:
159 ----------------------------------------------------------------------
147 ----------------------------------------------------------------------
160 There is support for simple option lists, but only with long
148 There is support for simple option lists, but only with long
161 options:
149 options:
162
150
163 --all Output all.
151 --all Output all.
164 --both Output both (this description is quite long).
152 --both Output both (this description is quite long).
165 --long Output all day long.
153 --long Output all day long.
166 --par This option has two paragraphs in its
154 --par This option has two paragraphs in its
167 description. This is the first.
155 description. This is the first.
168
156
169 This is the second. Blank lines may be omitted
157 This is the second. Blank lines may be omitted
170 between options (as above) or left in (as here).
158 between options (as above) or left in (as here).
171
159
172 The next paragraph looks like an option list, but lacks the
160 The next paragraph looks like an option list, but lacks the
173 two-space marker after the option. It is treated as a normal
161 two-space marker after the option. It is treated as a normal
174 paragraph:
162 paragraph:
175
163
176 --foo bar baz
164 --foo bar baz
177 ----------------------------------------------------------------------
165 ----------------------------------------------------------------------
178
166
179 options formatted to fit within 30 characters:
167 options formatted to fit within 30 characters:
180 ----------------------------------------------------------------------
168 ----------------------------------------------------------------------
181 There is support for simple
169 There is support for simple
182 option lists, but only with
170 option lists, but only with
183 long options:
171 long options:
184
172
185 --all Output all.
173 --all Output all.
186 --both Output both (this
174 --both Output both (this
187 description is
175 description is
188 quite long).
176 quite long).
189 --long Output all day
177 --long Output all day
190 long.
178 long.
191 --par This option has two
179 --par This option has two
192 paragraphs in its
180 paragraphs in its
193 description. This
181 description. This
194 is the first.
182 is the first.
195
183
196 This is the second.
184 This is the second.
197 Blank lines may be
185 Blank lines may be
198 omitted between
186 omitted between
199 options (as above)
187 options (as above)
200 or left in (as
188 or left in (as
201 here).
189 here).
202
190
203 The next paragraph looks like
191 The next paragraph looks like
204 an option list, but lacks the
192 an option list, but lacks the
205 two-space marker after the
193 two-space marker after the
206 option. It is treated as a
194 option. It is treated as a
207 normal paragraph:
195 normal paragraph:
208
196
209 --foo bar baz
197 --foo bar baz
210 ----------------------------------------------------------------------
198 ----------------------------------------------------------------------
211
199
212 fields formatted to fit within 60 characters:
200 fields formatted to fit within 60 characters:
213 ----------------------------------------------------------------------
201 ----------------------------------------------------------------------
214 Field lists give a simple two-column layout:
202 Field lists give a simple two-column layout:
215
203
216 key The whitespace following the key is
204 key The whitespace following the key is
217 significant for the wrapping of this text.
205 significant for the wrapping of this text.
218 another key More text. The indentation on the following
206 another key More text. The indentation on the following
219 lines is not significant.
207 lines is not significant.
220 ----------------------------------------------------------------------
208 ----------------------------------------------------------------------
221
209
222 fields formatted to fit within 30 characters:
210 fields formatted to fit within 30 characters:
223 ----------------------------------------------------------------------
211 ----------------------------------------------------------------------
224 Field lists give a simple two-
212 Field lists give a simple two-
225 column layout:
213 column layout:
226
214
227 key The whitespace
215 key The whitespace
228 following the
216 following the
229 key is
217 key is
230 significant for
218 significant for
231 the wrapping of
219 the wrapping of
232 this text.
220 this text.
233 another key More text. The
221 another key More text. The
234 indentation on
222 indentation on
235 the following
223 the following
236 lines is not
224 lines is not
237 significant.
225 significant.
238 ----------------------------------------------------------------------
226 ----------------------------------------------------------------------
239
227
General Comments 0
You need to be logged in to leave comments. Login now