Sha256: 2cc5a18743db646624e4a6d39785a2e933ceac0a723c12cc6515a3253444c370

Contents?: true

Size: 842 Bytes

Versions: 4

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class SmartPunctTest < Minitest::Test
  smart_punct = open_spec_file('smart_punct.txt')

  smart_punct.each do |testcase|
    doc = CommonMarker.render_doc(testcase[:markdown], :SMART)
    html = CommonMarker.render_html(testcase[:markdown], :SMART)

    define_method("test_smart_punct_example_#{testcase[:example]}") do
      doc_rendered = doc.to_html.strip
      html_rendered = html.strip

      assert_equal testcase[:html], doc_rendered, testcase[:markdown]
      assert_equal testcase[:html], html_rendered, testcase[:markdown]
    end
  end

  def test_smart_hardbreak_no_spaces_render_doc
    markdown = "\"foo\"\nbaz"
    result = "<p>“foo”<br />\nbaz</p>\n"
    doc = CommonMarker.render_doc(markdown, :SMART)
    assert_equal result, doc.to_html([:HARDBREAKS])
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
commonmarker-0.23.4 test/test_smartpunct.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.23.2/test/test_smartpunct.rb
commonmarker-0.23.2 test/test_smartpunct.rb
commonmarker-0.23.1 test/test_smartpunct.rb