tests: switch to minitest

Ruby 1.9+ uses Minitest as the backend for Test::Unit. As of Minitest 5,
the shim has broken some compatibility with Test::Unit::TestCase in some
scenarios.

Adjusts the test suite to support Minitest 5's syntax.

Minitest versions 4 and below do not support the newer Minitest::Test
class that arrived in version 5. For that case, use the
MiniTest::Unit::TestCase class as a fallback

Conflicts:
	test/integration/tags/for_tag_test.rb
	test/test_helper.rb
This commit is contained in:
Ken Dreyer
2014-07-28 16:33:42 +00:00
committed by Florian Weingarten
parent a8e63ff03d
commit ee4295c889
44 changed files with 148 additions and 173 deletions

View File

@@ -25,4 +25,5 @@ Gem::Specification.new do |s|
s.require_path = "lib"
s.add_development_dependency 'rake'
s.add_development_dependency 'minitest'
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class AssignTest < Test::Unit::TestCase
class AssignTest < Minitest::Test
include Liquid
def test_assigned_variable

View File

@@ -14,7 +14,7 @@ class BlankTestFileSystem
end
end
class BlankTest < Test::Unit::TestCase
class BlankTest < Minitest::Test
include Liquid
N = 10

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class CaptureTest < Test::Unit::TestCase
class CaptureTest < Minitest::Test
include Liquid
def test_captures_block_content_in_variable

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ContextTest < Test::Unit::TestCase
class ContextTest < Minitest::Test
include Liquid
def test_override_global_filter

View File

@@ -100,14 +100,12 @@ class RealEnumerableDrop < Liquid::Drop
end
end
class DropsTest < Test::Unit::TestCase
class DropsTest < Minitest::Test
include Liquid
def test_product_drop
assert_nothing_raised do
tpl = Liquid::Template.parse( ' ' )
tpl.render!('product' => ProductDrop.new)
end
tpl = Liquid::Template.parse( ' ' )
assert_equal ' ', tpl.render!('product' => ProductDrop.new)
end
def test_drop_does_only_respond_to_whitelisted_methods

View File

@@ -19,73 +19,61 @@ class ErrorDrop < Liquid::Drop
end
class ErrorHandlingTest < Test::Unit::TestCase
class ErrorHandlingTest < Minitest::Test
include Liquid
def test_standard_error
assert_nothing_raised do
template = Liquid::Template.parse( ' {{ errors.standard_error }} ' )
assert_equal ' Liquid error: standard error ', template.render('errors' => ErrorDrop.new)
template = Liquid::Template.parse( ' {{ errors.standard_error }} ' )
assert_equal ' Liquid error: standard error ', template.render('errors' => ErrorDrop.new)
assert_equal 1, template.errors.size
assert_equal StandardError, template.errors.first.class
end
assert_equal 1, template.errors.size
assert_equal StandardError, template.errors.first.class
end
def test_syntax
template = Liquid::Template.parse( ' {{ errors.syntax_error }} ' )
assert_equal ' Liquid syntax error: syntax error ', template.render('errors' => ErrorDrop.new)
assert_nothing_raised do
template = Liquid::Template.parse( ' {{ errors.syntax_error }} ' )
assert_equal ' Liquid syntax error: syntax error ', template.render('errors' => ErrorDrop.new)
assert_equal 1, template.errors.size
assert_equal SyntaxError, template.errors.first.class
end
assert_equal 1, template.errors.size
assert_equal SyntaxError, template.errors.first.class
end
def test_argument
assert_nothing_raised do
template = Liquid::Template.parse( ' {{ errors.argument_error }} ' )
assert_equal ' Liquid error: argument error ', template.render('errors' => ErrorDrop.new)
template = Liquid::Template.parse( ' {{ errors.argument_error }} ' )
assert_equal ' Liquid error: argument error ', template.render('errors' => ErrorDrop.new)
assert_equal 1, template.errors.size
assert_equal ArgumentError, template.errors.first.class
end
assert_equal 1, template.errors.size
assert_equal ArgumentError, template.errors.first.class
end
def test_missing_endtag_parse_time_error
assert_raise(Liquid::SyntaxError) do
assert_raises(Liquid::SyntaxError) do
Liquid::Template.parse(' {% for a in b %} ... ')
end
end
def test_unrecognized_operator
with_error_mode(:strict) do
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ')
end
end
end
def test_lax_unrecognized_operator
assert_nothing_raised do
template = Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :lax)
assert_equal ' Liquid error: Unknown operator =! ', template.render
assert_equal 1, template.errors.size
assert_equal Liquid::ArgumentError, template.errors.first.class
end
template = Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :lax)
assert_equal ' Liquid error: Unknown operator =! ', template.render
assert_equal 1, template.errors.size
assert_equal Liquid::ArgumentError, template.errors.first.class
end
def test_strict_error_messages
err = assert_raise(SyntaxError) do
err = assert_raises(SyntaxError) do
Liquid::Template.parse(' {% if 1 =! 2 %}ok{% endif %} ', :error_mode => :strict)
end
assert_equal 'Unexpected character = in "1 =! 2"', err.message
err = assert_raise(SyntaxError) do
err = assert_raises(SyntaxError) do
Liquid::Template.parse('{{%%%}}', :error_mode => :strict)
end
assert_equal 'Unexpected character % in "{{%%%}}"', err.message
@@ -102,7 +90,7 @@ class ErrorHandlingTest < Test::Unit::TestCase
# Liquid should not catch Exceptions that are not subclasses of StandardError, like Interrupt and NoMemoryError
def test_exceptions_propagate
assert_raise Exception do
assert_raises Exception do
template = Liquid::Template.parse( ' {{ errors.exception }} ' )
template.render('errors' => ErrorDrop.new)
end

View File

@@ -22,7 +22,7 @@ module SubstituteFilter
end
end
class FiltersTest < Test::Unit::TestCase
class FiltersTest < Minitest::Test
include Liquid
def setup
@@ -107,7 +107,7 @@ class FiltersTest < Test::Unit::TestCase
end
end
class FiltersInTemplate < Test::Unit::TestCase
class FiltersInTemplate < Minitest::Test
include Liquid
def test_local_global

View File

@@ -12,7 +12,7 @@ module CanadianMoneyFilter
end
end
class HashOrderingTest < Test::Unit::TestCase
class HashOrderingTest < Minitest::Test
include Liquid
def test_global_register_order

View File

@@ -27,7 +27,7 @@ module FunnyFilter
end
class OutputTest < Test::Unit::TestCase
class OutputTest < Minitest::Test
include Liquid
def setup

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ParsingQuirksTest < Test::Unit::TestCase
class ParsingQuirksTest < Minitest::Test
include Liquid
def test_parsing_css
@@ -9,30 +9,28 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
def test_raise_on_single_close_bracet
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
Template.parse("text {{method} oh nos!")
end
end
def test_raise_on_label_and_no_close_bracets
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
Template.parse("TEST {{ ")
end
end
def test_raise_on_label_and_no_close_bracets_percent
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
Template.parse("TEST {% ")
end
end
def test_error_on_empty_filter
assert_nothing_raised do
Template.parse("{{test}}")
Template.parse("{{|test}}")
end
assert Template.parse("{{test}}")
assert Template.parse("{{|test}}")
with_error_mode(:strict) do
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
Template.parse("{{test |a|b|}}")
end
end
@@ -40,7 +38,7 @@ class ParsingQuirksTest < Test::Unit::TestCase
def test_meaningless_parens_error
with_error_mode(:strict) do
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
markup = "a == 'foo' or (b == 'bar' and c == 'baz') or false"
Template.parse("{% if #{markup} %} YES {% endif %}")
end
@@ -49,11 +47,11 @@ class ParsingQuirksTest < Test::Unit::TestCase
def test_unexpected_characters_syntax_error
with_error_mode(:strict) do
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
markup = "true && false"
Template.parse("{% if #{markup} %} YES {% endif %}")
end
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
markup = "false || true"
Template.parse("{% if #{markup} %} YES {% endif %}")
end
@@ -61,11 +59,9 @@ class ParsingQuirksTest < Test::Unit::TestCase
end
def test_no_error_on_lax_empty_filter
assert_nothing_raised do
Template.parse("{{test |a|b|}}", :error_mode => :lax)
Template.parse("{{test}}", :error_mode => :lax)
Template.parse("{{|test|}}", :error_mode => :lax)
end
assert Template.parse("{{test |a|b|}}", :error_mode => :lax)
assert Template.parse("{{test}}", :error_mode => :lax)
assert Template.parse("{{|test|}}", :error_mode => :lax)
end
def test_meaningless_parens_lax

View File

@@ -6,7 +6,7 @@ module SecurityFilter
end
end
class SecurityTest < Test::Unit::TestCase
class SecurityTest < Minitest::Test
include Liquid
def test_no_instance_eval

View File

@@ -41,7 +41,7 @@ class TestEnumerable < Liquid::Drop
end
end
class StandardFiltersTest < Test::Unit::TestCase
class StandardFiltersTest < Minitest::Test
include Liquid
def setup

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class BreakTagTest < Test::Unit::TestCase
class BreakTagTest < Minitest::Test
include Liquid
# tests that no weird errors are raised if break is called outside of a

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ContinueTagTest < Test::Unit::TestCase
class ContinueTagTest < Minitest::Test
include Liquid
# tests that no weird errors are raised if continue is called outside of a

View File

@@ -6,7 +6,7 @@ class ThingWithValue < Liquid::Drop
end
end
class ForTagTest < Test::Unit::TestCase
class ForTagTest < Minitest::Test
include Liquid
def test_for
@@ -303,7 +303,7 @@ HERE
end
def test_bad_variable_naming_in_for_loop
assert_raise(Liquid::SyntaxError) do
assert_raises(Liquid::SyntaxError) do
Liquid::Template.parse('{% for a/b in x %}{% endfor %}')
end
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class IfElseTagTest < Test::Unit::TestCase
class IfElseTagTest < Minitest::Test
include Liquid
def test_if
@@ -37,25 +37,19 @@ class IfElseTagTest < Test::Unit::TestCase
end
def test_comparison_of_strings_containing_and_or_or
assert_nothing_raised do
awful_markup = "a == 'and' and b == 'or' and c == 'foo and bar' and d == 'bar or baz' and e == 'foo' and foo and bar"
assigns = {'a' => 'and', 'b' => 'or', 'c' => 'foo and bar', 'd' => 'bar or baz', 'e' => 'foo', 'foo' => true, 'bar' => true}
assert_template_result(' YES ',"{% if #{awful_markup} %} YES {% endif %}", assigns)
end
awful_markup = "a == 'and' and b == 'or' and c == 'foo and bar' and d == 'bar or baz' and e == 'foo' and foo and bar"
assigns = {'a' => 'and', 'b' => 'or', 'c' => 'foo and bar', 'd' => 'bar or baz', 'e' => 'foo', 'foo' => true, 'bar' => true}
assert_template_result(' YES ',"{% if #{awful_markup} %} YES {% endif %}", assigns)
end
def test_comparison_of_expressions_starting_with_and_or_or
assigns = {'order' => {'items_count' => 0}, 'android' => {'name' => 'Roy'}}
assert_nothing_raised do
assert_template_result( "YES",
"{% if android.name == 'Roy' %}YES{% endif %}",
assigns)
end
assert_nothing_raised do
assert_template_result( "YES",
"{% if order.items_count == 0 %}YES{% endif %}",
assigns)
end
assert_template_result( "YES",
"{% if android.name == 'Roy' %}YES{% endif %}",
assigns)
assert_template_result( "YES",
"{% if order.items_count == 0 %}YES{% endif %}",
assigns)
end
def test_if_and
@@ -135,11 +129,11 @@ class IfElseTagTest < Test::Unit::TestCase
end
def test_syntax_error_no_variable
assert_raise(SyntaxError){ assert_template_result('', '{% if jerry == 1 %}')}
assert_raises(SyntaxError){ assert_template_result('', '{% if jerry == 1 %}')}
end
def test_syntax_error_no_expression
assert_raise(SyntaxError) { assert_template_result('', '{% if %}') }
assert_raises(SyntaxError) { assert_template_result('', '{% if %}') }
end
def test_if_with_custom_condition
@@ -159,7 +153,7 @@ class IfElseTagTest < Test::Unit::TestCase
end
def test_operators_are_whitelisted
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
assert_template_result('', %({% if 1 or throw or or 1 %}yes{% endif %}))
end
end

View File

@@ -65,7 +65,7 @@ class CustomInclude < Liquid::Tag
end
end
class IncludeTagTest < Test::Unit::TestCase
class IncludeTagTest < Minitest::Test
include Liquid
def setup
@@ -132,7 +132,7 @@ class IncludeTagTest < Test::Unit::TestCase
Liquid::Template.file_system = infinite_file_system.new
assert_raise(Liquid::StackLevelError) do
assert_raises(Liquid::StackLevelError) do
Template.parse("{% include 'loop' %}").render!
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class IncrementTagTest < Test::Unit::TestCase
class IncrementTagTest < Minitest::Test
include Liquid
def test_inc

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class RawTagTest < Test::Unit::TestCase
class RawTagTest < Minitest::Test
include Liquid
def test_tag_in_raw

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class StandardTagTest < Test::Unit::TestCase
class StandardTagTest < Minitest::Test
include Liquid
def test_no_transform
@@ -66,7 +66,7 @@ class StandardTagTest < Test::Unit::TestCase
end
def test_capture_detects_bad_syntax
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
assert_template_result('content foo content foo ',
'{{ var2 }}{% capture %}{{ var }} foo {% endcapture %}{{ var2 }}{{ var2 }}',
{'var' => 'content' })
@@ -229,11 +229,11 @@ class StandardTagTest < Test::Unit::TestCase
end
def test_case_detects_bad_syntax
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
assert_template_result('', '{% case false %}{% when %}true{% endcase %}', {})
end
assert_raise(SyntaxError) do
assert_raises(SyntaxError) do
assert_template_result('', '{% case false %}{% huh %}true{% endcase %}', {})
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class StatementsTest < Test::Unit::TestCase
class StatementsTest < Minitest::Test
include Liquid
def test_true_eql_true

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class TableRowTest < Test::Unit::TestCase
class TableRowTest < Minitest::Test
include Liquid
class ArrayDrop < Liquid::Drop

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class UnlessElseTagTest < Test::Unit::TestCase
class UnlessElseTagTest < Minitest::Test
include Liquid
def test_unless

View File

@@ -28,7 +28,7 @@ class ErroneousDrop < Liquid::Drop
end
end
class TemplateTest < Test::Unit::TestCase
class TemplateTest < Minitest::Test
include Liquid
def test_instance_assigns_persist_on_same_template_object_between_parses
@@ -93,7 +93,7 @@ class TemplateTest < Test::Unit::TestCase
assert t.resource_limits[:reached]
t.resource_limits = { :render_length_limit => 10 }
assert_equal "0123456789", t.render!()
assert_not_nil t.resource_limits[:render_length_current]
refute_nil t.resource_limits[:render_length_current]
end
def test_resource_limits_render_score
@@ -107,7 +107,7 @@ class TemplateTest < Test::Unit::TestCase
assert t.resource_limits[:reached]
t.resource_limits = { :render_score_limit => 200 }
assert_equal (" foo " * 100), t.render!()
assert_not_nil t.resource_limits[:render_score_current]
refute_nil t.resource_limits[:render_score_current]
end
def test_resource_limits_assign_score
@@ -117,7 +117,7 @@ class TemplateTest < Test::Unit::TestCase
assert t.resource_limits[:reached]
t.resource_limits = { :assign_score_limit => 2 }
assert_equal "", t.render!()
assert_not_nil t.resource_limits[:assign_score_current]
refute_nil t.resource_limits[:assign_score_current]
end
def test_resource_limits_aborts_rendering_after_first_error

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class VariableTest < Test::Unit::TestCase
class VariableTest < Minitest::Test
include Liquid
def test_simple_variable

View File

@@ -1,7 +1,6 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'test/unit/assertions'
require 'minitest/autorun'
require 'spy/integration'
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__)), '..', 'lib'))
@@ -14,41 +13,45 @@ if env_mode = ENV['LIQUID_PARSER_MODE']
end
Liquid::Template.error_mode = mode
if Minitest.const_defined?('Test')
# We're on Minitest 5+. Nothing to do here.
else
# Minitest 4 doesn't have Minitest::Test yet.
Minitest::Test = MiniTest::Unit::TestCase
end
module Test
module Unit
class TestCase
def fixture(name)
File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", name)
end
module Minitest
class Test
def fixture(name)
File.join(File.expand_path(File.dirname(__FILE__)), "fixtures", name)
end
end
module Assertions
include Liquid
def assert_template_result(expected, template, assigns = {}, message = nil)
assert_equal expected, Template.parse(template).render!(assigns)
end
module Assertions
include Liquid
def assert_template_result_matches(expected, template, assigns = {}, message = nil)
return assert_template_result(expected, template, assigns, message) unless expected.is_a? Regexp
def assert_template_result(expected, template, assigns = {}, message = nil)
assert_equal expected, Template.parse(template).render!(assigns)
end
assert_match expected, Template.parse(template).render!(assigns)
end
def assert_template_result_matches(expected, template, assigns = {}, message = nil)
return assert_template_result(expected, template, assigns, message) unless expected.is_a? Regexp
def assert_match_syntax_error(match, template, registers = {})
exception = assert_raises(Liquid::SyntaxError) {
Template.parse(template).render(assigns)
}
assert_match match, exception.message
end
assert_match expected, Template.parse(template).render!(assigns)
end
def assert_match_syntax_error(match, template, registers = {})
exception = assert_raise(Liquid::SyntaxError) {
Template.parse(template).render(assigns)
}
assert_match match, exception.message
end
def with_error_mode(mode)
old_mode = Liquid::Template.error_mode
Liquid::Template.error_mode = mode
yield
Liquid::Template.error_mode = old_mode
end
end # Assertions
end # Unit
end # Test
def with_error_mode(mode)
old_mode = Liquid::Template.error_mode
Liquid::Template.error_mode = mode
yield
Liquid::Template.error_mode = old_mode
end
end
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class BlockUnitTest < Test::Unit::TestCase
class BlockUnitTest < Minitest::Test
include Liquid
def test_blankspace
@@ -45,10 +45,7 @@ class BlockUnitTest < Test::Unit::TestCase
def test_with_custom_tag
Liquid::Template.register_tag("testtag", Block)
assert_nothing_thrown do
template = Liquid::Template.parse( "{% testtag %} {% endtesttag %}")
end
assert Liquid::Template.parse( "{% testtag %} {% endtesttag %}")
end
private

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ConditionUnitTest < Test::Unit::TestCase
class ConditionUnitTest < Minitest::Test
include Liquid
def test_basic_condition

View File

@@ -63,7 +63,7 @@ class ArrayLike
end
end
class ContextUnitTest < Test::Unit::TestCase
class ContextUnitTest < Minitest::Test
include Liquid
def setup
@@ -107,16 +107,14 @@ class ContextUnitTest < Test::Unit::TestCase
end
def test_scoping
assert_nothing_raised do
@context.push
@context.push
@context.pop
assert_raises(Liquid::ContextError) do
@context.pop
end
assert_raise(Liquid::ContextError) do
@context.pop
end
assert_raise(Liquid::ContextError) do
assert_raises(Liquid::ContextError) do
@context.push
@context.pop
@context.pop

View File

@@ -1,10 +1,10 @@
require 'test_helper'
class FileSystemUnitTest < Test::Unit::TestCase
class FileSystemUnitTest < Minitest::Test
include Liquid
def test_default
assert_raise(FileSystemError) do
assert_raises(FileSystemError) do
BlankFileSystem.new.read_template_file("dummy", {'dummy'=>'smarty'})
end
end
@@ -14,15 +14,15 @@ class FileSystemUnitTest < Test::Unit::TestCase
assert_equal "/some/path/_mypartial.liquid" , file_system.full_path("mypartial")
assert_equal "/some/path/dir/_mypartial.liquid", file_system.full_path("dir/mypartial")
assert_raise(FileSystemError) do
assert_raises(FileSystemError) do
file_system.full_path("../dir/mypartial")
end
assert_raise(FileSystemError) do
assert_raises(FileSystemError) do
file_system.full_path("/dir/../../dir/mypartial")
end
assert_raise(FileSystemError) do
assert_raises(FileSystemError) do
file_system.full_path("/etc/passwd")
end
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class I18nUnitTest < Test::Unit::TestCase
class I18nUnitTest < Minitest::Test
include Liquid
def setup
@@ -20,13 +20,13 @@ class I18nUnitTest < Test::Unit::TestCase
end
# def test_raises_translation_error_on_undefined_interpolation_key
# assert_raise I18n::TranslationError do
# assert_raises I18n::TranslationError do
# @i18n.translate("whatever", :oopstypos => "yes")
# end
# end
def test_raises_unknown_translation
assert_raise I18n::TranslationError do
assert_raises I18n::TranslationError do
@i18n.translate("doesnt_exist")
end
end

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class LexerUnitTest < Test::Unit::TestCase
class LexerUnitTest < Minitest::Test
include Liquid
def test_strings

View File

@@ -36,7 +36,7 @@ class TestClassC::LiquidDropClass
end
end
class ModuleExUnitTest < Test::Unit::TestCase
class ModuleExUnitTest < Minitest::Test
include Liquid
def setup

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ParserUnitTest < Test::Unit::TestCase
class ParserUnitTest < Minitest::Test
include Liquid
def test_consume

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class RegexpUnitTest < Test::Unit::TestCase
class RegexpUnitTest < Minitest::Test
include Liquid
def test_empty

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class StrainerUnitTest < Test::Unit::TestCase
class StrainerUnitTest < Minitest::Test
include Liquid
module AccessScopeFilters

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class TagUnitTest < Test::Unit::TestCase
class TagUnitTest < Minitest::Test
include Liquid
def test_tag

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class CaseTagUnitTest < Test::Unit::TestCase
class CaseTagUnitTest < Minitest::Test
include Liquid
def test_case_nodelist

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class ForTagUnitTest < Test::Unit::TestCase
class ForTagUnitTest < Minitest::Test
def test_for_nodelist
template = Liquid::Template.parse('{% for item in items %}FOR{% endfor %}')
assert_equal ['FOR'], template.root.nodelist[0].nodelist

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class IfTagUnitTest < Test::Unit::TestCase
class IfTagUnitTest < Minitest::Test
def test_if_nodelist
template = Liquid::Template.parse('{% if true %}IF{% else %}ELSE{% endif %}')
assert_equal ['IF', 'ELSE'], template.root.nodelist[0].nodelist

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class TemplateUnitTest < Test::Unit::TestCase
class TemplateUnitTest < Minitest::Test
include Liquid
def test_sets_default_localization_in_document

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class TokenizerTest < Test::Unit::TestCase
class TokenizerTest < Minitest::Test
def test_tokenize_strings
assert_equal [' '], tokenize(' ')
assert_equal ['hello world'], tokenize('hello world')

View File

@@ -1,6 +1,6 @@
require 'test_helper'
class VariableUnitTest < Test::Unit::TestCase
class VariableUnitTest < Minitest::Test
include Liquid
def test_variable