Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Added a few ugly testcases #138

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions curlylint/parse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,50 @@ def test_optional_container(self):
"""
content.parse(src)

def test_optional_container_with_nesting(self):
src = '{% if a %}<a href="{{ b }}">{% endif %}c<b>d</b>{% if a %}</a>{% endif %}'
self.assertEqual(src, str(content.parse(src)))

src = """
{% if a %} <a href="{{ b }}"> {% endif %}
c <b> d </b>
{% if a %} </a> {% endif %}
"""
content.parse(src)

def test_optional_container_with_else_block(self):
src = '{% if a %}<a href="b">{% else %}<b>{% endif %}c<b>d</b>{% if a %}</a>{% else %}</b>{% endif %}'
self.assertEqual(src, str(content.parse(src)))

src = """
{% if a %} <a href="b"> {% else %} <b> {% endif %}
c <b> d </b>
{% if a %} </a> {% else %} </b> {% endif %}
"""
content.parse(src)

def test_optional_container_with_elif_block(self):
src = '{% if a %}<a href="b">{% elif e %}<b>{% endif %}c<b>d</b>{% if a %}</a>{% elif e %}</b>{% endif %}'
self.assertEqual(src, str(content.parse(src)))

src = """
{% if a %} <a href="b"> {% elif e %} <b> {% endif %}
c <b> d </b>
{% if a %} </a> {% elif e %} </b> {% endif %}
"""
content.parse(src)

def test_different_container_openings(self):
src = '{% if a %}<a href="b">{% else %}<a href="c">{% endif %}c<b>d</b></a>'
self.assertEqual(src, str(content.parse(src)))

src = """
{% if a %} <a href="b"> {% else %} <a href="c"> {% endif %}
c <b> d </b>
</a>
"""
content.parse(src)

def test_whole_document(self):
src = '<html lang="fr"><body>Hello<br></body></html>'
self.assertEqual(src, str(element.parse(src)))