Skip to content

Commit

Permalink
move redos tests to /redos folder
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Mar 12, 2019
1 parent b169e7b commit 775d08d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 3 deletions.
23 changes: 20 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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;
Expand Down Expand Up @@ -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
}
});

Expand Down Expand Up @@ -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)));
});
}

/**
Expand Down
Empty file removed test/new/redos_html_closing.html
Empty file.
Empty file removed test/new/redos_nolink.html
Empty file.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions test/redos/redos_html_closing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>&lt;tag &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot; &quot;&quot;&lt;&quot; /&gt;a&#39;a</p>
File renamed without changes.
1 change: 1 addition & 0 deletions test/redos/redos_nolink.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<p>![[[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[][[]!\</p>
File renamed without changes.

0 comments on commit 775d08d

Please sign in to comment.