Sha256: 7a25733f1d10b89bdbcbfe057bad6149314d31c379f71189df7777daeea72eb8

Contents?: true

Size: 1.36 KB

Versions: 17

Compression:

Stored size: 1.36 KB

Contents

# -*- coding: utf-8; frozen_string_literal: true -*-
#
#--
# Copyright (C) 2009-2019 Thomas Leitner <t_leitner@gmx.at>
#
# This file is part of kramdown which is licensed under the MIT.
#++
#

$:.unshift File.dirname(__FILE__) + '/../lib'
require 'kramdown'
require 'test/unit/assertions'
require 'yaml'

include Test::Unit::Assertions

arg = ARGV[0] || File.join(File.dirname(__FILE__), 'testcases')

arg = if File.directory?(arg)
        File.join(arg, '**/*.text')
      else
        arg + '.text'
      end

width = ((size = `stty size 2>/dev/null`).length > 0 ? size.split.last.to_i : 72) rescue 72
width -= 8
fwidth = 0
Dir[arg].each {|f| fwidth = [fwidth, f.length + 10].max }.each do |file|
  print(('Testing ' + file + ' ').ljust([fwidth, width].min))
  $stdout.flush

  html_file = file.sub('.text', '.html')
  opts_file = file.sub('.text', '.options')
  opts_file = File.join(File.dirname(file), 'options') unless File.exist?(opts_file)
  options = File.exist?(opts_file) ? YAML.safe_load(File.read(opts_file)) : {auto_ids: false, footnote_nr: 1}
  doc = Kramdown::Document.new(File.read(file), options)
  begin
    assert_equal(File.read(html_file), doc.to_html)
    puts 'PASSED'
  rescue StandardError
    puts '  FAILED'
    puts $!.message if $VERBOSE
    puts $!.backtrace if $DEBUG
  end
  puts "Warnings:\n" + doc.warnings.join("\n") if !doc.warnings.empty? && $VERBOSE
end

Version data entries

17 entries across 17 versions & 4 rubygems

Version Path
kramdown-2.5.1 test/run_tests.rb
kramdown-2.5.0 test/run_tests.rb
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/kramdown-2.4.0/test/run_tests.rb
kramdown-2.4.0 test/run_tests.rb
kramdown-2.3.2 test/run_tests.rb
kramdown-2.3.1 test/run_tests.rb
daqing_kramdown-2.3.2 test/run_tests.rb
daqing_kramdown-2.3.1 test/run_tests.rb
zine_brewer-1.5.0 vendor/bundle/ruby/2.7.0/gems/kramdown-2.3.0/test/run_tests.rb
zine_brewer-1.3.0 vendor/bundle/ruby/2.7.0/gems/kramdown-2.3.0/test/run_tests.rb
kramdown-2.3.0 test/run_tests.rb
kramdown-2.2.1 test/run_tests.rb
kramdown-2.2.0 test/run_tests.rb
kramdown-2.1.0 test/run_tests.rb
kramdown-2.0.0 test/run_tests.rb
kramdown-2.0.0.beta2 test/run_tests.rb
kramdown-2.0.0.beta1 test/run_tests.rb