diff --git a/test/index.js b/test/index.js index 29b19bc5de..0a3541bc09 100644 --- a/test/index.js +++ b/test/index.js @@ -176,6 +176,17 @@ function testFile(engine, file, filename, index) { l = html.length; + if (l === 0 && text.length > 0) { + text = text.substring(0, Math.min(30, text.length)); + + console.log(' failed in %dms at offset %d. Near: "%s".\n', prettyElapsedTime(elapsed), 0, text); + + console.log('\nActual:\n%s\n', text.trim() || text); + console.log('\nExpected:\n\n'); + + return false; + } + for (j = 0; j < l; j++) { if (text[j] !== html[j]) { text = text.substring( @@ -188,7 +199,7 @@ function testFile(engine, file, filename, index) { console.log(' failed in %dms at offset %d. Near: "%s".\n', prettyElapsedTime(elapsed), j, text); - console.log('\nGot:\n%s\n', text.trim() || text); + console.log('\nActual:\n%s\n', text.trim() || text); console.log('\nExpected:\n%s\n', html.trim() || html); return false; @@ -346,11 +357,11 @@ function time(options) { */ function fix() { - ['compiled_tests', 'original', 'new'].forEach(function(dir) { + ['compiled_tests', 'original', 'new', 'redos'].forEach(function(dir) { try { fs.mkdirSync(path.resolve(__dirname, dir)); } catch (e) { - ; + // directory already exists } }); @@ -435,6 +446,12 @@ function fix() { fs.writeFileSync(path.resolve(__dirname, 'compiled_tests', file), fs.readFileSync(path.resolve(__dirname, 'new', file))); }); + + // cp redos/* tests/ + fs.readdirSync(path.resolve(__dirname, 'redos')).forEach(function(file) { + fs.writeFileSync(path.resolve(__dirname, 'compiled_tests', file), + fs.readFileSync(path.resolve(__dirname, 'redos', file))); + }); } /** diff --git a/test/new/redos_html_closing.html b/test/new/redos_html_closing.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/new/redos_nolink.html b/test/new/redos_nolink.html deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/new/link_redos.html b/test/redos/link_redos.html similarity index 100% rename from test/new/link_redos.html rename to test/redos/link_redos.html diff --git a/test/new/link_redos.md b/test/redos/link_redos.md similarity index 100% rename from test/new/link_redos.md rename to test/redos/link_redos.md diff --git a/test/redos/redos_html_closing.html b/test/redos/redos_html_closing.html new file mode 100644 index 0000000000..543e775acb --- /dev/null +++ b/test/redos/redos_html_closing.html @@ -0,0 +1 @@ +

<tag "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" ""<" />a'a

diff --git a/test/new/redos_html_closing.md b/test/redos/redos_html_closing.md similarity index 100% rename from test/new/redos_html_closing.md rename to test/redos/redos_html_closing.md diff --git a/test/redos/redos_nolink.html b/test/redos/redos_nolink.html new file mode 100644 index 0000000000..5915375324 --- /dev/null +++ b/test/redos/redos_nolink.html @@ -0,0 +1 @@ +

![[[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[]!\

diff --git a/test/new/redos_nolink.md b/test/redos/redos_nolink.md similarity index 100% rename from test/new/redos_nolink.md rename to test/redos/redos_nolink.md