X-Git-Url: http://nitlanguage.org diff --git a/lib/markdown/test_markdown.nit b/lib/markdown/test_markdown.nit index eb4d744..e552883 100644 --- a/lib/markdown/test_markdown.nit +++ b/lib/markdown/test_markdown.nit @@ -416,7 +416,9 @@ This is a paragraph

This is a paragraph * and this is not a list

""" - var res = test.md_to_html.write_to_string + var proc = new MarkdownProcessor + proc.ext_mode = false + var res = proc.process(test).write_to_string assert res == exp end @@ -431,9 +433,7 @@ This is a paragraph
  • and this is not a list
  • """ - var proc = new MarkdownProcessor - proc.ext_mode = true - var res = proc.process(test).write_to_string + var res = test.md_to_html.write_to_string assert res == exp end @@ -479,8 +479,6 @@ end tell end fun test_process_code_ext1 do - var processor = new MarkdownProcessor - processor.ext_mode = true var test = """ Here is an example of AppleScript: ~~~ @@ -504,13 +502,11 @@ end tell </div> """ - var res = processor.process(test).write_to_string + var res = test.md_to_html.write_to_string assert res == exp end fun test_process_code_ext2 do - var processor = new MarkdownProcessor - processor.ext_mode = true var test = """ Here is an example of AppleScript: ``` @@ -534,11 +530,14 @@ end tell </div> """ - var res = processor.process(test).write_to_string + var res = test.md_to_html.write_to_string assert res == exp end fun test_process_code_ext3 do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = """ Here is an example of AppleScript: beep @@ -547,13 +546,11 @@ Here is an example of AppleScript:

    Here is an example of AppleScript: beep

    """ - var res = test.md_to_html.write_to_string + var res = proc.process(test).write_to_string assert res == exp end fun test_process_code_ext4 do - var processor = new MarkdownProcessor - processor.ext_mode = true var test = """ Here is an example of AppleScript: beep @@ -563,7 +560,21 @@ Here is an example of AppleScript:
    beep
     
    """ - var res = processor.process(test).write_to_string + var res = test.md_to_html.write_to_string + assert res == exp + end + + fun test_process_code_ext5 do + var test = """ +```nit +print "Hello World!" +``` +""" + var exp = """ +
    print "Hello World!"
    +
    +""" + var res = test.md_to_html.write_to_string assert res == exp end @@ -704,18 +715,18 @@ __double underscores__ end fun test_process_emph3 do + var proc = new MarkdownProcessor + proc.ext_mode = false var test = "Con_cat_this" var exp = "

    Concatthis

    \n" - var res = test.md_to_html.write_to_string + var res = proc.process(test).write_to_string assert res == exp end fun test_process_emph_ext do var test = "Con_cat_this" var exp = "

    Con_cat_this

    \n" - var proc = new MarkdownProcessor - proc.ext_mode = true - var res = proc.process(test).write_to_string + var res = test.md_to_html.write_to_string assert res == exp end @@ -986,6 +997,29 @@ break with a line-ending space.

    assert res == exp end + fun test_process_strike do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = "This is how you ~~strike text~~" + var exp = "

    This is how you ~~strike text~~

    \n" + var res = proc.process(test).write_to_string + assert exp == res + end + + fun test_process_strike_ext do + var test = "This is how you ~~strike text~~" + var exp = "

    This is how you strike text

    \n" + var res = test.md_to_html.write_to_string + assert exp == res + end + + fun test_escape_bad_html do + var test = "-1 if < , +1 if > and 0 otherwise" + var exp = "

    -1 if < , +1 if > and 0 otherwise

    \n" + var res = test.md_to_html.write_to_string + assert exp == res + end + fun test_daring_encoding do var test = """ AT&T has an ampersand in their name. @@ -1353,6 +1387,9 @@ Here's how you put `` `backticks` `` in a code span. end fun test_daring_pars do + var proc = new MarkdownProcessor + proc.ext_mode = false + var test = """ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item. @@ -1373,7 +1410,7 @@ list item.

    Here's one with a bullet. * criminey.

    """ - var res = test.md_to_html.write_to_string + var res = proc.process(test).write_to_string assert res == exp end @@ -2491,8 +2528,6 @@ class TestLine var subject: MDLine - init do end - fun test_is_empty do subject = new MDLine("") assert subject.is_empty @@ -2574,7 +2609,6 @@ class TestLine fun test_line_type_ext do var v = new MarkdownProcessor - v.ext_mode = true subject = new MDLine(" ~~~") assert v.line_kind(subject) isa LineFence subject = new MDLine(" ```")