require 'ecrire/markdown' require 'minitest/autorun' class MarkdownTest < Minitest::Test def test_paragraph document = Ecrire::Markdown.parse("Hello world!\nThis is nice.") assert_equal '
Hello world!
This is nice.
', document.to_html end def test_header document = Ecrire::Markdown.parse('# test') assert_equal "test
", document.to_html end def test_bold document = Ecrire::Markdown.parse('**test**') assert_equal "test
", document.to_html end def test_bold_and_italic document = Ecrire::Markdown.parse('***bold and italic***') assert_equal "bold and italic
", document.to_html document = Ecrire::Markdown.parse('**bold** and *italic*') assert_equal "bold and italic
", document.to_html end def test_code_inline document = Ecrire::Markdown.parse("This is a ~~~ruby inline code~~~ snippet") assert_equal "This is a inline code
snippet
This is a inline code
snippet. Multiple instance
can coexist on the same line
", document.to_html document = Ecrire::Markdown.parse("~~~ruby a title\n# A comment\nRails.application\n~~~") assert_equal "# A comment\nRails.application
", document.to_html end def test_unordered_list document = Ecrire::Markdown.parse("- ruby\n- Go") assert_equal 'a title # A comment\nRails.application