Sha256: 43456d77ae18fc7bf7824b47bdeb232499488ee652901f75a49d38c2026d2971

Contents?: true

Size: 1021 Bytes

Versions: 20

Compression:

Stored size: 1021 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

    define_method("test_html_renderer_example_#{testcase[:example]}") do
      actual = HtmlRenderer.new(extensions: testcase[:extensions]).render(doc).rstrip
      assert_equal testcase[:html], actual, testcase[:markdown]
    end

    define_method("test_sourcepos_example_#{testcase[:example]}") do
      lhs = doc.to_html(:SOURCEPOS, testcase[:extensions]).rstrip
      rhs = HtmlRenderer.new(options: :SOURCEPOS, extensions: testcase[:extensions]).render(doc).rstrip
      assert_equal lhs, rhs, testcase[:markdown]
    end
  end
end

Version data entries

20 entries across 20 versions & 2 rubygems

Version Path
commonmarker-0.17.13 test/test_spec.rb
commonmarker-0.17.12 test/test_spec.rb
commonmarker-0.17.11 test/test_spec.rb
commonmarker-0.17.10 test/test_spec.rb
tdiary-5.0.8 vendor/bundle/gems/commonmarker-0.17.9/test/test_spec.rb
commonmarker-0.17.9 test/test_spec.rb
commonmarker-0.17.8 test/test_spec.rb
commonmarker-0.17.7.1 test/test_spec.rb
commonmarker-0.17.7 test/test_spec.rb
commonmarker-0.17.6 test/test_spec.rb
commonmarker-0.17.5 test/test_spec.rb
commonmarker-0.17.4 test/test_spec.rb
commonmarker-0.17.2 test/test_spec.rb
commonmarker-0.17.1 test/test_spec.rb
commonmarker-0.17.0 test/test_spec.rb
commonmarker-0.16.8 test/test_spec.rb
commonmarker-0.16.7 test/test_spec.rb
commonmarker-0.16.6 test/test_spec.rb
commonmarker-0.16.5 test/test_spec.rb
commonmarker-0.16.4 test/test_spec.rb