Skip to content

Commit

Permalink
Del: Add test for del/strikethrough exponential backtracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ariabuckles committed Aug 31, 2019
1 parent f3332cd commit f5311e5
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions __tests__/simple-markdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4266,5 +4266,19 @@ describe("simple markdown", function() {
var duration = Date.now() - startTime;
assert.ok(duration < 10, "Expected parsing to finish in <10ms, but was " + duration + "ms.");
});

it("should parse long del strikethroughs quickly", function() {
var source = '~~~h' + Array(30).join(' ') + 'i';
var startTime = Date.now();
var parsed = inlineParse(source);
var duration = Date.now() - startTime;
assert.ok(duration < 10, "Expected parsing to finish in <10ms, but was " + duration + "ms.");

source = '~~~h' + Array(1000).join(' ') + 'i';
startTime = Date.now();
parsed = inlineParse(source);
duration = Date.now() - startTime;
assert.ok(duration < 10, "Expected parsing to finish in <10ms, but was " + duration + "ms.");
});
});
});

0 comments on commit f5311e5

Please sign in to comment.