Index: trunk/extensions/VisualEditor/tests/parser/parserTests.js |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | |
27 | 27 | var argv = optimist.usage( 'Usage: $0', { |
28 | 28 | 'filter': { |
29 | | - description: 'Only run tests whose descriptions which match given regex (option not implemented)', |
| 29 | + description: 'Only run tests whose descriptions which match given regex', |
30 | 30 | alias: 'regex', |
31 | 31 | }, |
32 | 32 | 'help': { |
— | — | @@ -38,6 +38,11 @@ |
39 | 39 | boolean: true, |
40 | 40 | }, |
41 | 41 | } |
| 42 | + ).check( function(argv) { |
| 43 | + if( argv.filter === true ) { |
| 44 | + throw "--filter need an argument"; |
| 45 | + } |
| 46 | + } |
42 | 47 | ).argv // keep that |
43 | 48 | ; |
44 | 49 | |
— | — | @@ -45,6 +50,11 @@ |
46 | 51 | optimist.showHelp(); |
47 | 52 | process.exit( 0 ); |
48 | 53 | } |
| 54 | +var test_filter = null; |
| 55 | +if( argv.filter ) { // null is the default by definition |
| 56 | + test_filter = new RegExp( argv.filter ); |
| 57 | + console.log( "Filtering title test using Regexp " + test_filter ); |
| 58 | +} |
49 | 59 | |
50 | 60 | // @fixme wrap more or this setup in a common module |
51 | 61 | |
— | — | @@ -334,6 +344,10 @@ |
335 | 345 | //processArticle(item); |
336 | 346 | break; |
337 | 347 | case 'test': |
| 348 | + if( test_filter && -1 === item.title.search( test_filter ) ) { |
| 349 | + // Skip test whose title does not match --filter |
| 350 | + break; |
| 351 | + } |
338 | 352 | // Add comments to following test. |
339 | 353 | item.comments = comments; |
340 | 354 | comments = []; |