Skip to content

Commit

Permalink
Add tests for triple quotes feature (from 7b259b9)
Browse files Browse the repository at this point in the history
  • Loading branch information
aelzenaar committed Jan 24, 2019
1 parent 7b259b9 commit 0660157
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/tm-cases/link_patterns_escape.html
@@ -0,0 +1,9 @@
<p>Recipe 123 and <a href="http://bugs.activestate.com/show_bug.cgi?id=234">a link to Komodo bug 234</a> are related.</p>

<p><a href="http://example.org/Recipe 123">This is a link which has a pattern inside the url that shouldn't expand.</a></p>

<p>Matched pattern is escaped: PEP 42 might be related too.</p>

<p>Triple quotes not surrounding a matched pattern: PEP """42""" might be related too.</p>

<p>"""This is some random text which should not be touched."""</p>
8 changes: 8 additions & 0 deletions test/tm-cases/link_patterns_escape.opts
@@ -0,0 +1,8 @@
{"extras": ["link-patterns"],
"link_patterns": [
(re.compile("recipe\s+(\d+)", re.I), r"http://code.activestate.com/recipes/\1/"),
(re.compile("(?:komodo\s+)?bug\s+(\d+)", re.I), r"http://bugs.activestate.com/show_bug.cgi?id=\1"),
(re.compile("PEP\s+(\d+)", re.I), lambda m: "http://www.python.org/dev/peps/pep-%04d/" % int(m.group(1))),
],
}

9 changes: 9 additions & 0 deletions test/tm-cases/link_patterns_escape.text
@@ -0,0 +1,9 @@
"""Recipe 123""" and <a href="http://bugs.activestate.com/show_bug.cgi?id=234">a link to """Komodo bug 234"""</a> are related.

<a href="http://example.org/"""Recipe 123"""">This is a link which has a pattern inside the url that shouldn't expand.</a>

Matched pattern is escaped: """PEP 42""" might be related too.

Triple quotes not surrounding a matched pattern: PEP """42""" might be related too.

"""This is some random text which should not be touched."""

0 comments on commit 0660157

Please sign in to comment.