r104419 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104418‎ | r104419 | r104420 >
Date:11:38, 28 November 2011
Author:gwicke
Status:deferred
Tags:
Comment:
Shorten diff output and display comments before each failing test.
Modified paths:
  • /trunk/extensions/VisualEditor/tests/parser/parserTests.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js
@@ -167,6 +167,7 @@
168168 function printTitle() {
169169 console.log('=====================================================');
170170 console.log(item.title);
 171+ console.log(item.comments.join('\n'));
171172 console.log("INPUT:");
172173 console.log(item.input + "\n");
173174 }
@@ -212,7 +213,7 @@
213214 var patch = jsDiff.createPatch('wikitext.txt', a, b, 'before', 'after');
214215
215216 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/, ''));
217218 }
218219 }
219220 }
@@ -230,13 +231,25 @@
231232 tokenizer.processToken({type: 'END'});
232233 }
233234
 235+var comments = [];
234236
235237 cases.forEach(function(item) {
236238 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;
241254 }
242255 }
243256 });

Status & tagging log