Sha256: 9d03c4d8d2034cbe72915785de71f9e5821786b4c468e7934cf9834f4c1b1fd7

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

# coding: utf-8
require 'test_helper'

class TestEncoding < Minitest::Test
  # see http://git.io/vq4FR
  def test_encoding
    contents = File.read(File.join(FIXTURES_DIR, 'curly.md'), encoding: 'utf-8')
    doc = CommonMarker.render_doc(contents, :smart)
    render = doc.to_html
    assert_equal render.rstrip, '<p>This curly quote “makes commonmarker throw an exception”.</p>'
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
commonmarker-0.14.4 test/test_encoding.rb
commonmarker-0.14.3 test/test_encoding.rb
commonmarker-0.14.2 test/test_encoding.rb
commonmarker-0.14.1 test/test_encoding.rb
commonmarker-0.14.0 test/test_encoding.rb
commonmarker-0.13.0 test/test_encoding.rb