@@ -176,6 +176,17 @@ function testFile(engine, file, filename, index) {
176
176
177
177
l = html . length ;
178
178
179
+ if ( l === 0 && text . length > 0 ) {
180
+ text = text . substring ( 0 , Math . min ( 30 , text . length ) ) ;
181
+
182
+ console . log ( ' failed in %dms at offset %d. Near: "%s".\n' , prettyElapsedTime ( elapsed ) , 0 , text ) ;
183
+
184
+ console . log ( '\nActual:\n%s\n' , text . trim ( ) || text ) ;
185
+ console . log ( '\nExpected:\n\n' ) ;
186
+
187
+ return false ;
188
+ }
189
+
179
190
for ( j = 0 ; j < l ; j ++ ) {
180
191
if ( text [ j ] !== html [ j ] ) {
181
192
text = text . substring (
@@ -188,7 +199,7 @@ function testFile(engine, file, filename, index) {
188
199
189
200
console . log ( ' failed in %dms at offset %d. Near: "%s".\n' , prettyElapsedTime ( elapsed ) , j , text ) ;
190
201
191
- console . log ( '\nGot :\n%s\n' , text . trim ( ) || text ) ;
202
+ console . log ( '\nActual :\n%s\n' , text . trim ( ) || text ) ;
192
203
console . log ( '\nExpected:\n%s\n' , html . trim ( ) || html ) ;
193
204
194
205
return false ;
@@ -346,11 +357,11 @@ function time(options) {
346
357
*/
347
358
348
359
function fix ( ) {
349
- [ 'compiled_tests' , 'original' , 'new' ] . forEach ( function ( dir ) {
360
+ [ 'compiled_tests' , 'original' , 'new' , 'redos' ] . forEach ( function ( dir ) {
350
361
try {
351
362
fs . mkdirSync ( path . resolve ( __dirname , dir ) ) ;
352
363
} catch ( e ) {
353
- ;
364
+ // directory already exists
354
365
}
355
366
} ) ;
356
367
@@ -393,20 +404,6 @@ function fix() {
393
404
. replace ( / & _ _ Q U O T _ _ ; / g, '"' )
394
405
. replace ( / & _ _ A P O S _ _ ; / g, '\'' ) ;
395
406
396
- // add heading id's
397
- html = html . replace ( / < ( h [ 1 - 6 ] ) > ( [ ^ < ] + ) < \/ \1> / g, function ( s , h , text ) {
398
- var id = text
399
- . replace ( / & # 3 9 ; / g, '\'' )
400
- . replace ( / & q u o t ; / g, '"' )
401
- . replace ( / & g t ; / g, '>' )
402
- . replace ( / & l t ; / g, '<' )
403
- . replace ( / & a m p ; / g, '&' ) ;
404
-
405
- id = id . toLowerCase ( ) . replace ( / [ ^ \w ] + / g, '-' ) ;
406
-
407
- return '<' + h + ' id="' + id + '">' + text + '</' + h + '>' ;
408
- } ) ;
409
-
410
407
fs . writeFileSync ( file , html ) ;
411
408
} ) ;
412
409
@@ -435,6 +432,12 @@ function fix() {
435
432
fs . writeFileSync ( path . resolve ( __dirname , 'compiled_tests' , file ) ,
436
433
fs . readFileSync ( path . resolve ( __dirname , 'new' , file ) ) ) ;
437
434
} ) ;
435
+
436
+ // cp redos/* tests/
437
+ fs . readdirSync ( path . resolve ( __dirname , 'redos' ) ) . forEach ( function ( file ) {
438
+ fs . writeFileSync ( path . resolve ( __dirname , 'compiled_tests' , file ) ,
439
+ fs . readFileSync ( path . resolve ( __dirname , 'redos' , file ) ) ) ;
440
+ } ) ;
438
441
}
439
442
440
443
/**
0 commit comments