From 775d08db5a608878b3d9682e42601c4fddd7e33b Mon Sep 17 00:00:00 2001 From: Tony Brix Date: Mon, 11 Mar 2019 13:41:33 -0500 Subject: [PATCH] move redos tests to /redos folder --- test/index.js | 23 ++++++++++++++++++++--- test/new/redos_html_closing.html | 0 test/new/redos_nolink.html | 0 test/{new => redos}/link_redos.html | 0 test/{new => redos}/link_redos.md | 0 test/redos/redos_html_closing.html | 1 + test/{new => redos}/redos_html_closing.md | 0 test/redos/redos_nolink.html | 1 + test/{new => redos}/redos_nolink.md | 0 9 files changed, 22 insertions(+), 3 deletions(-) delete mode 100644 test/new/redos_html_closing.html delete mode 100644 test/new/redos_nolink.html rename test/{new => redos}/link_redos.html (100%) rename test/{new => redos}/link_redos.md (100%) create mode 100644 test/redos/redos_html_closing.html rename test/{new => redos}/redos_html_closing.md (100%) create mode 100644 test/redos/redos_nolink.html rename test/{new => redos}/redos_nolink.md (100%) 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