# encoding: UTF-8 $: << File.join(File.dirname(__FILE__), "../lib") require 'test/unit' require 'multi_markdown' class ExtensionsTest < Test::Unit::TestCase def test_force_complete_document mmd = 'Some very simple _Markdown_' # Don't change anything (default) multimarkdown = MultiMarkdown.new(mmd) assert !multimarkdown.to_html.include?('' tag: '#{multimarkdown.to_html}'" # Force complete document multimarkdown = MultiMarkdown.new(mmd, :complete) assert multimarkdown.to_html.include?('' tag: '#{multimarkdown.to_html}'" end def test_force_snippet_mode mmd = "Meta1: Value\nMeta2: Value2\n\nHello!" # Don't change anything (default) multimarkdown = MultiMarkdown.new(mmd) assert multimarkdown.to_html.include?('' tag: '#{multimarkdown.to_html}'" # Force snippet multimarkdown = MultiMarkdown.new(mmd, :snippet) assert !multimarkdown.to_html.include?('' tag: '#{multimarkdown.to_html}'" end def test_smart_quotes mmd = 'Quotes are "beautiful"' # Don't change anything (default) multimarkdown = MultiMarkdown.new(mmd) assert multimarkdown.to_html.include?('“'), "Didn't find nice quote '“': '#{multimarkdown.to_html}'" assert multimarkdown.to_html.include?('”'), "Didn't find nice quote '”': '#{multimarkdown.to_html}'" assert !multimarkdown.to_html.include?('"'), "Found quote '"': '#{multimarkdown.to_html}'" # Disble smart quotes multimarkdown = MultiMarkdown.new(mmd, :no_smart_quotes) assert_equal '

Quotes are "beautiful"

', multimarkdown.to_html.strip end def test_footnotes mmd = <This is a {++green ++}test.

", multimarkdown.to_html.strip # Include changes multimarkdown = MultiMarkdown.new(mmd, :critic_markup_accept_all) assert_equal "

This is a green test.

", multimarkdown.to_html.strip # Ignore changes multimarkdown = MultiMarkdown.new(mmd, :critic_markup_reject_all) assert_equal "

This is a test.

", multimarkdown.to_html.strip end def test_escaped_line_breaks mmd = <'), "Didn't find '
' tag: '#{multimarkdown.to_html}'" end end