Sha256: 0eb12687e7ec63f6dce2d1a23dceaa98971e4c2dc442580b9e78ef9882f3ba91

Contents?: true

Size: 1.06 KB

Versions: 10

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true

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(:UNSAFE, testcase[:extensions]).rstrip
      assert_equal testcase[:html], actual, testcase[:markdown]
    end

    define_method("test_html_renderer_example_#{testcase[:example]}") do
      actual = HtmlRenderer.new(options: :UNSAFE, 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(%i[UNSAFE SOURCEPOS], testcase[:extensions]).rstrip
      rhs = HtmlRenderer.new(options: %i[UNSAFE SOURCEPOS], extensions: testcase[:extensions]).render(doc).rstrip
      assert_equal lhs, rhs, testcase[:markdown]
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
commonmarker-0.23.4 test/test_spec.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.23.2/test/test_spec.rb
commonmarker-0.23.2 test/test_spec.rb
commonmarker-0.23.1 test/test_spec.rb
commonmarker-0.23.0 test/test_spec.rb
commonmarker-0.22.0 test/test_spec.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/commonmarker-0.21.2/test/test_spec.rb
commonmarker-0.21.2 test/test_spec.rb
commonmarker-0.21.1 test/test_spec.rb
commonmarker-0.21.0 test/test_spec.rb