@@ -176,6 +176,17 @@ function testFile(engine, file, filename, index) {
176176
177177 l = html . length ;
178178
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+
179190 for ( j = 0 ; j < l ; j ++ ) {
180191 if ( text [ j ] !== html [ j ] ) {
181192 text = text . substring (
@@ -188,7 +199,7 @@ function testFile(engine, file, filename, index) {
188199
189200 console . log ( ' failed in %dms at offset %d. Near: "%s".\n' , prettyElapsedTime ( elapsed ) , j , text ) ;
190201
191- console . log ( '\nGot :\n%s\n' , text . trim ( ) || text ) ;
202+ console . log ( '\nActual :\n%s\n' , text . trim ( ) || text ) ;
192203 console . log ( '\nExpected:\n%s\n' , html . trim ( ) || html ) ;
193204
194205 return false ;
@@ -346,11 +357,11 @@ function time(options) {
346357 */
347358
348359function fix ( ) {
349- [ 'compiled_tests' , 'original' , 'new' ] . forEach ( function ( dir ) {
360+ [ 'compiled_tests' , 'original' , 'new' , 'redos' ] . forEach ( function ( dir ) {
350361 try {
351362 fs . mkdirSync ( path . resolve ( __dirname , dir ) ) ;
352363 } catch ( e ) {
353- ;
364+ // directory already exists
354365 }
355366 } ) ;
356367
@@ -393,20 +404,6 @@ function fix() {
393404 . replace ( / & _ _ Q U O T _ _ ; / g, '"' )
394405 . replace ( / & _ _ A P O S _ _ ; / g, '\'' ) ;
395406
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-
410407 fs . writeFileSync ( file , html ) ;
411408 } ) ;
412409
@@ -435,6 +432,12 @@ function fix() {
435432 fs . writeFileSync ( path . resolve ( __dirname , 'compiled_tests' , file ) ,
436433 fs . readFileSync ( path . resolve ( __dirname , 'new' , file ) ) ) ;
437434 } ) ;
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+ } ) ;
438441}
439442
440443/**
0 commit comments