add new tests
This commit is contained in:
parent
06bc97ab77
commit
99288c294a
1 changed files with 16 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
import re
|
||||
from gmirator.generate import (
|
||||
process_file,
|
||||
process_list,
|
||||
|
@ -11,13 +12,26 @@ def test_process_file():
|
|||
pass
|
||||
|
||||
def test_process_list():
|
||||
test_str = "this is a line outside a list"
|
||||
assert process_list(test_str, True) == ("</ul>\n\n", False)
|
||||
assert process_list(test_str, False) == (test_str, False)
|
||||
test_str = "* this is a list item"
|
||||
assert process_list(test_str, True) == ("<li>this is a list item</li>", True)
|
||||
assert process_list(test_str, False) == ("<ul>\n<li>this is a list item</li>", True)
|
||||
pass
|
||||
|
||||
def test_process_inline():
|
||||
assert process_inline("*Hello* ~~world~~!") == "<em>Hello</em> <s>world</s>!"
|
||||
|
||||
def test_repl_url():
|
||||
pass
|
||||
def test_repl_url_external_gmi_url():
|
||||
external_url = "=> gemini://domain/gempage.gmi\n"
|
||||
new_url = re.sub(r'^=> (?P<url>[^ ]*) ?(?P<text>.*)\n', repl_url, external_url)
|
||||
assert new_url == '<a href="gemini://domain/gempage.gmi">=> gemini://domain/gempage.gmi</a><br>\n'
|
||||
|
||||
def test_repl_url_internal_gmi_url():
|
||||
external_url = "=> /gempage.gmi title\n"
|
||||
new_url = re.sub(r'^=> (?P<url>[^ ]*) ?(?P<text>.*)\n', repl_url, external_url)
|
||||
assert new_url == '<a href="/gempage.html">=> title</a><br>\n'
|
||||
|
||||
def test_repl_heading():
|
||||
pass
|
||||
|
|
Loading…
Reference in a new issue