import re
from gmirator.generate import (
process_file,
process_list,
process_inline,
repl_url,
repl_heading
)
def test_process_file():
pass
def test_process_list():
test_str = "this is a line outside a list"
assert process_list(test_str, True) == ("\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) == ("
this is a list item", True)
assert process_list(test_str, False) == ("\n- this is a list item
", True)
pass
def test_process_inline():
assert process_inline("*Hello* ~~world~~!") == "Hello world!"
def test_repl_url_external_gmi_url():
external_url = "=> gemini://domain/gempage.gmi\n"
new_url = re.sub(r'^=> (?P[^ ]*) ?(?P.*)\n', repl_url, external_url)
assert new_url == '=> gemini://domain/gempage.gmi
\n'
def test_repl_url_internal_gmi_url():
external_url = "=> /gempage.gmi title\n"
new_url = re.sub(r'^=> (?P[^ ]*) ?(?P.*)\n', repl_url, external_url)
assert new_url == '=> title
\n'
def test_repl_heading():
pass