mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Switch to Minitest
This way we're sure to be using the same test library on all Ruby versions and platforms.
This commit is contained in:
parent
500d28fb0f
commit
ea8b22f250
7 changed files with 20 additions and 18 deletions
|
@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
||||||
spec.add_development_dependency 'rails'
|
spec.add_development_dependency 'rails'
|
||||||
spec.add_development_dependency 'ruby_parser'
|
spec.add_development_dependency 'ruby_parser'
|
||||||
spec.add_development_dependency 'rbench'
|
spec.add_development_dependency 'rbench'
|
||||||
|
spec.add_development_dependency 'minitest'
|
||||||
|
|
||||||
spec.description = <<-END
|
spec.description = <<-END
|
||||||
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
Haml (HTML Abstraction Markup Language) is a layer on top of HTML or XML that's
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
require File.dirname(__FILE__) + '/test_helper'
|
require File.dirname(__FILE__) + '/test_helper'
|
||||||
|
|
||||||
class EngineTest < Test::Unit::TestCase
|
class EngineTest < MiniTest::Unit::TestCase
|
||||||
# A map of erroneous Haml documents to the error messages they should produce.
|
# A map of erroneous Haml documents to the error messages they should produce.
|
||||||
# The error messages may be arrays;
|
# The error messages may be arrays;
|
||||||
# if so, the second element should be the line number that should be reported for the error.
|
# if so, the second element should be the line number that should be reported for the error.
|
||||||
|
@ -1434,7 +1434,7 @@ HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_arbitrary_output_option
|
def test_arbitrary_output_option
|
||||||
assert_raise_message(Haml::Error, "Invalid output format :html1") do
|
assert_raises_message(Haml::Error, "Invalid output format :html1") do
|
||||||
engine("%br", :format => :html1)
|
engine("%br", :format => :html1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1484,7 +1484,7 @@ HAML
|
||||||
|
|
||||||
# because anything before the doctype triggers quirks mode in IE
|
# because anything before the doctype triggers quirks mode in IE
|
||||||
def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
|
def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
|
||||||
assert_no_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
|
refute_match(/^\s+/, render("!!! xml\n!!!", :format => :html4))
|
||||||
end
|
end
|
||||||
|
|
||||||
# HTML5
|
# HTML5
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Haml::Helpers
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class HelperTest < Test::Unit::TestCase
|
class HelperTest < MiniTest::Unit::TestCase
|
||||||
Post = Struct.new('Post', :body, :error_field, :errors)
|
Post = Struct.new('Post', :body, :error_field, :errors)
|
||||||
class PostErrors
|
class PostErrors
|
||||||
def on(name)
|
def on(name)
|
||||||
|
@ -289,19 +289,19 @@ HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_haml_tag_raises_error_for_multiple_content
|
def test_haml_tag_raises_error_for_multiple_content
|
||||||
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo' do\n bar") }
|
assert_raises(Haml::Error) { render("- haml_tag :p, 'foo' do\n bar") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_haml_tag_flags
|
def test_haml_tag_flags
|
||||||
assert_equal("<p />\n", render("- haml_tag :p, :/"))
|
assert_equal("<p />\n", render("- haml_tag :p, :/"))
|
||||||
assert_equal("<p>kumquat</p>\n", render("- haml_tag :p, :< do\n kumquat"))
|
assert_equal("<p>kumquat</p>\n", render("- haml_tag :p, :< do\n kumquat"))
|
||||||
|
|
||||||
assert_raise(Haml::Error) { render("- haml_tag :p, 'foo', :/") }
|
assert_raises(Haml::Error) { render("- haml_tag :p, 'foo', :/") }
|
||||||
assert_raise(Haml::Error) { render("- haml_tag :p, :/ do\n foo") }
|
assert_raises(Haml::Error) { render("- haml_tag :p, :/ do\n foo") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_haml_tag_error_return
|
def test_haml_tag_error_return
|
||||||
assert_raise(Haml::Error) { render("= haml_tag :p") }
|
assert_raises(Haml::Error) { render("= haml_tag :p") }
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_haml_tag_with_multiline_string
|
def test_haml_tag_with_multiline_string
|
||||||
|
@ -417,7 +417,7 @@ HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_error_return
|
def test_error_return
|
||||||
assert_raise(Haml::Error, <<MESSAGE) {render("= haml_concat 'foo'")}
|
assert_raises(Haml::Error, <<MESSAGE) {render("= haml_concat 'foo'")}
|
||||||
haml_concat outputs directly to the Haml template.
|
haml_concat outputs directly to the Haml template.
|
||||||
Disregard its return value and use the - operator,
|
Disregard its return value and use the - operator,
|
||||||
or use capture_haml to get the value as a String.
|
or use capture_haml to get the value as a String.
|
||||||
|
|
|
@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/test_helper'
|
||||||
require File.dirname(__FILE__) + '/html2haml/erb_tests'
|
require File.dirname(__FILE__) + '/html2haml/erb_tests'
|
||||||
require 'haml/html'
|
require 'haml/html'
|
||||||
|
|
||||||
class Html2HamlTest < Test::Unit::TestCase
|
class Html2HamlTest < MiniTest::Unit::TestCase
|
||||||
def test_empty_render_should_remain_empty
|
def test_empty_render_should_remain_empty
|
||||||
assert_equal '', render('')
|
assert_equal '', render('')
|
||||||
end
|
end
|
||||||
|
|
|
@ -39,7 +39,7 @@ class DummyController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TemplateTest < Test::Unit::TestCase
|
class TemplateTest < MiniTest::Unit::TestCase
|
||||||
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
||||||
TEMPLATES = %w{ very_basic standard helpers
|
TEMPLATES = %w{ very_basic standard helpers
|
||||||
whitespace_handling original_engine list helpful
|
whitespace_handling original_engine list helpful
|
||||||
|
@ -194,7 +194,7 @@ class TemplateTest < Test::Unit::TestCase
|
||||||
|
|
||||||
unless Haml::Util.ap_geq_3?
|
unless Haml::Util.ap_geq_3?
|
||||||
def test_form_for_error_return
|
def test_form_for_error_return
|
||||||
assert_raise(Haml::Error) { render(<<HAML) }
|
assert_raises(Haml::Error) { render(<<HAML) }
|
||||||
= form_for :article, @article, :url => '' do |f|
|
= form_for :article, @article, :url => '' do |f|
|
||||||
Title:
|
Title:
|
||||||
= f.text_field :title
|
= f.text_field :title
|
||||||
|
@ -204,7 +204,7 @@ HAML
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_form_tag_error_return
|
def test_form_tag_error_return
|
||||||
assert_raise(Haml::Error) { render(<<HAML) }
|
assert_raises(Haml::Error) { render(<<HAML) }
|
||||||
= form_tag '' do
|
= form_tag '' do
|
||||||
Title:
|
Title:
|
||||||
Body:
|
Body:
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'bundler/setup'
|
require 'bundler/setup'
|
||||||
|
require "test/unit" # On JRuby, tests won't run unless we include this WTF
|
||||||
|
require 'minitest/autorun'
|
||||||
require 'action_pack'
|
require 'action_pack'
|
||||||
require 'action_controller'
|
require 'action_controller'
|
||||||
require 'action_view'
|
require 'action_view'
|
||||||
|
@ -19,7 +21,6 @@ end
|
||||||
|
|
||||||
ActionController::Base.logger = Logger.new(nil)
|
ActionController::Base.logger = Logger.new(nil)
|
||||||
|
|
||||||
require 'test/unit'
|
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'haml'
|
require 'haml'
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ require 'haml/template'
|
||||||
Haml::Template.options[:ugly] = false
|
Haml::Template.options[:ugly] = false
|
||||||
Haml::Template.options[:format] = :xhtml
|
Haml::Template.options[:format] = :xhtml
|
||||||
|
|
||||||
class Test::Unit::TestCase
|
class MiniTest::Unit::TestCase
|
||||||
def assert_warning(message)
|
def assert_warning(message)
|
||||||
the_real_stderr, $stderr = $stderr, StringIO.new
|
the_real_stderr, $stderr = $stderr, StringIO.new
|
||||||
yield
|
yield
|
||||||
|
@ -73,7 +74,7 @@ class Test::Unit::TestCase
|
||||||
'" type="hidden" value="' + char + '" /></div>'
|
'" type="hidden" value="' + char + '" /></div>'
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_raise_message(klass, message)
|
def assert_raises_message(klass, message)
|
||||||
yield
|
yield
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
assert_instance_of(klass, e)
|
assert_instance_of(klass, e)
|
||||||
|
@ -82,7 +83,7 @@ class Test::Unit::TestCase
|
||||||
flunk "Expected exception #{klass}, none raised"
|
flunk "Expected exception #{klass}, none raised"
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_raise_line(line)
|
def assert_raises_line(line)
|
||||||
yield
|
yield
|
||||||
rescue Sass::SyntaxError => e
|
rescue Sass::SyntaxError => e
|
||||||
assert_equal(line, e.sass_line)
|
assert_equal(line, e.sass_line)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require File.dirname(__FILE__) + '/test_helper'
|
require File.dirname(__FILE__) + '/test_helper'
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
|
|
||||||
class UtilTest < Test::Unit::TestCase
|
class UtilTest < MiniTest::Unit::TestCase
|
||||||
include Haml::Util
|
include Haml::Util
|
||||||
|
|
||||||
class Dumpable
|
class Dumpable
|
||||||
|
|
Loading…
Add table
Reference in a new issue