Index: trunk/extensions/VisualEditor/tests/parser/dumpGrepper.js |
— | — | @@ -60,16 +60,18 @@ |
61 | 61 | |
62 | 62 | var reader = new dumpReader.DumpReader(), |
63 | 63 | grepper = new DumpGrepper( re ), |
64 | | - revisions = 0, |
65 | | - matches = 0; |
| 64 | + stats = { |
| 65 | + revisions: 0, |
| 66 | + matches: 0 |
| 67 | + }; |
66 | 68 | |
67 | 69 | reader.on( 'revision', function ( revision ) { |
68 | | - revisions++; |
| 70 | + stats.revisions++; |
69 | 71 | grepper.grepRev( revision ); |
70 | 72 | } ); |
71 | 73 | |
72 | 74 | grepper.on( 'match', function ( revision, matches ) { |
73 | | - matches++; |
| 75 | + stats.matches++; |
74 | 76 | for ( var i = 0, l = matches.length; i < l; i++ ) { |
75 | 77 | console.log( '== Match: [[' + revision.page.title + ']] ==' ); |
76 | 78 | var m = matches[i]; |
— | — | @@ -91,14 +93,14 @@ |
92 | 94 | process.stdin.on ( 'end' , function() { |
93 | 95 | // Print some stats |
94 | 96 | console.log( '################################################' ); |
95 | | - console.log( 'Total revisions: ' + revisions ); |
96 | | - console.log( 'Total matches: ' + matches ); |
97 | | - console.log( 'Ratio: ' + (matches / revisions * 100) + '%' ); |
| 97 | + console.log( 'Total revisions: ' + stats.revisions ); |
| 98 | + console.log( 'Total matches: ' + stats.matches ); |
| 99 | + console.log( 'Ratio: ' + (stats.matches / stats.revisions * 100) + '%' ); |
98 | 100 | console.log( '################################################' ); |
99 | 101 | } ); |
100 | 102 | |
| 103 | + process.stdin.on('data', reader.push.bind(reader) ); |
101 | 104 | process.stdin.setEncoding('utf8'); |
102 | | - process.stdin.on('data', reader.push.bind(reader) ); |
103 | 105 | process.stdin.resume(); |
104 | 106 | |
105 | 107 | |