Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -167,6 +167,7 @@ |
168 | 168 | function printTitle() { |
169 | 169 | console.log('====================================================='); |
170 | 170 | console.log(item.title); |
| 171 | + console.log(item.comments.join('\n')); |
171 | 172 | console.log("INPUT:"); |
172 | 173 | console.log(item.input + "\n"); |
173 | 174 | } |
— | — | @@ -212,7 +213,7 @@ |
213 | 214 | var patch = jsDiff.createPatch('wikitext.txt', a, b, 'before', 'after'); |
214 | 215 | |
215 | 216 | console.log('DIFF:'); |
216 | | - console.log(patch.replace(/^[^\n]*\n[^\n]*\n/, '')); |
| 217 | + console.log(patch.replace(/^[^\n]*\n[^\n]*\n[^\n]*\n[^\n]*\n/, '')); |
217 | 218 | } |
218 | 219 | } |
219 | 220 | } |
— | — | @@ -230,13 +231,25 @@ |
231 | 232 | tokenizer.processToken({type: 'END'}); |
232 | 233 | } |
233 | 234 | |
| 235 | +var comments = []; |
234 | 236 | |
235 | 237 | cases.forEach(function(item) { |
236 | 238 | if (typeof item == 'object') { |
237 | | - if (item.type == 'article') { |
238 | | - processArticle(item); |
239 | | - } else if (item.type == 'test') { |
240 | | - processTest(item); |
| 239 | + switch(item.type) { |
| 240 | + case 'article': |
| 241 | + //processArticle(item); |
| 242 | + break; |
| 243 | + case 'test': |
| 244 | + // Add comments to following test. |
| 245 | + item.comments = comments; |
| 246 | + comments = []; |
| 247 | + processTest(item); |
| 248 | + break; |
| 249 | + case 'comment': |
| 250 | + comments.push(item.comment); |
| 251 | + break; |
| 252 | + default: |
| 253 | + break; |
241 | 254 | } |
242 | 255 | } |
243 | 256 | }); |