Sha256: f2415d778ae0f852cecd5c3382712acdccf17dae33aa3e842d3f23737430f42a

Contents?: true

Size: 769 Bytes

Versions: 5

Compression:

Stored size: 769 Bytes

Contents

# frozen_string_literal: true

require 'test_helper'

class TestEncoding < Minitest::Test
  # see http://git.io/vq4FR
  def test_encoding
    contents = fixtures_file('curly.md')
    doc = CommonMarker.render_doc(contents, :SMART)
    render = doc.to_html
    assert_equal('<p>This curly quote “makes commonmarker throw an exception”.</p>', render.rstrip)

    render = doc.to_xml
    assert_includes(render, '<text xml:space="preserve">This curly quote “makes commonmarker throw an exception”.</text>')
  end

  def test_string_content_is_utf8
    doc = CommonMarker.render_doc('Hi *there*')
    text = doc.first_child.last_child.first_child
    assert_equal('there', text.string_content)
    assert_equal('UTF-8', text.string_content.encoding.name)
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

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