Sha256: c6ab7c9ee813668434fea8dab678d81eeff0136bf4c7a5f66e0f352f2b1b051d

Contents?: true

Size: 832 Bytes

Versions: 5

Compression:

Stored size: 832 Bytes

Contents

require 'test_helper'
require 'json'

class TestSpec < Minitest::Test
  spec = open_spec_file('spec.txt')

  spec.each do |testcase|
    next if testcase[:extensions].include?(:disabled)
    doc = CommonMarker.render_doc(testcase[:markdown], :DEFAULT, testcase[:extensions])

    define_method("test_to_html_example_#{testcase[:example]}") do
      actual = doc.to_html(:DEFAULT, testcase[:extensions]).rstrip
      assert_equal testcase[:html], actual, testcase[:markdown]
    end

    unless testcase[:extensions].any?
      define_method("test_html_renderer_example_#{testcase[:example]}") do
        actual = HtmlRenderer.new.render(doc).rstrip
        File.write('test.txt', testcase[:html])
        File.write('actual.txt', actual)
        assert_equal testcase[:html], actual, testcase[:markdown]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
commonmarker-0.16.1 test/test_spec.rb
commonmarker-0.16.2 test/test_spec.rb
commonmarker-0.16.3 test/test_spec.rb
commonmarker-0.16.0 test/test_spec.rb
commonmarker-0.15.0 test/test_spec.rb