Skip to content

Commit

Permalink
Heading: Add test for exponential backtracking in headings
Browse files Browse the repository at this point in the history
  • Loading branch information
ariabuckles committed Aug 31, 2019
1 parent 89797fe commit f7cda49
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions __tests__/simple-markdown-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4258,5 +4258,13 @@ 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 headings quickly", function() {
var source = '### Hi ' + Array(1200).join(' ') + 'there ### \n\n';
var startTime = Date.now();
var parsed = blockParse(source);
var duration = Date.now() - startTime;
assert.ok(duration < 10, "Expected parsing to finish in <10ms, but was " + duration + "ms.");
});
});
});

0 comments on commit f7cda49

Please sign in to comment.