Sha256: 4788ce9891aa513ac4656d666bf37e6b1e5216ca4bacc84e18c5473bb1b941cb

Contents?: true

Size: 1.38 KB

Versions: 16

Compression:

Stored size: 1.38 KB

Contents

# coding: UTF-8
require 'test_helper'

class SmartyHTMLTest < Redcarpet::TestCase
  def setup
    @renderer = Redcarpet::Render::SmartyHTML
  end

  def test_that_smartyhtml_converts_single_quotes
    markdown = render("They're not for sale.")
    assert_equal "<p>They&rsquo;re not for sale.</p>\n", markdown
  end

  def test_that_smartyhtml_converts_double_quotes
    rd = render(%("Quoted text"))
    assert_equal %(<p>&ldquo;Quoted text&rdquo;</p>\n), rd
  end

  def test_that_smartyhtml_converts_double_hyphen
    rd = render("double hyphen -- ndash")
    assert_equal "<p>double hyphen &ndash; ndash</p>\n", rd
  end

  def test_that_smartyhtml_converts_triple_hyphen
    rd = render("triple hyphen --- mdash")
    assert_equal "<p>triple hyphen &mdash; mdash</p>\n", rd
  end

  def test_that_smartyhtml_ignores_double_hyphen_in_code
    rd = render("double hyphen in `--option`")
    assert_equal "<p>double hyphen in <code>--option</code></p>\n", rd
  end

  def test_that_smartyhtml_ignores_pre
    rd = render("    It's a test of \"pre\"\n")
    expected = "It&#39;s a test of &quot;pre&quot;"
    assert rd.include?(expected), "\"#{rd}\" should contain \"#{expected}\""
  end

  def test_that_smartyhtml_ignores_code
    rd = render("`It's a test of \"code\"`\n")
    expected = "It&#39;s a test of &quot;code&quot;"
    assert rd.include?(expected), "\"#{rd}\" should contain \"#{expected}\""
  end
end

Version data entries

16 entries across 16 versions & 4 rubygems

Version Path
mumukit-content-type-1.11.1 vendor/bundle/ruby/2.6.0/gems/redcarpet-3.3.4/test/smarty_html_test.rb
tdiary-5.0.2 vendor/bundle/gems/redcarpet-3.3.4/test/smarty_html_test.rb
tdiary-5.0.1 vendor/bundle/gems/redcarpet-3.3.4/test/smarty_html_test.rb
redcarpet_yt-0.1.0 test/smarty_html_test.rb
redcarpet_yt-0.0.10 test/smarty_html_test.rb
redcarpet_yt-0.0.9 test/smarty_html_test.rb
redcarpet_yt-0.0.8 test/smarty_html_test.rb
redcarpet_yt-0.0.7 test/smarty_html_test.rb
redcarpet_yt-0.0.6 test/smarty_html_test.rb
redcarpet_yt-0.0.5 test/smarty_html_test.rb
redcarpet_yt-0.0.4 test/smarty_html_test.rb
redcarpet_yt-0.0.3 test/smarty_html_test.rb
redcarpet_yt-0.0.2 test/smarty_html_test.rb
redcarpet_yt-0.0.1 test/smarty_html_test.rb
redcarpet-3.3.4 test/smarty_html_test.rb
redcarpet-3.3.3 test/smarty_html_test.rb