Keep original stack trace in Liquid::ArgumentError

This commit is contained in:
Nick Pearson
2015-10-28 14:15:09 -05:00
parent 31d7682f4e
commit c582023321
2 changed files with 13 additions and 1 deletions

View File

@@ -29,6 +29,18 @@ class StrainerUnitTest < Minitest::Test
end
end
def test_stainer_argument_error_contains_backtrace
strainer = Strainer.create(nil)
begin
strainer.invoke("public_filter", 1)
rescue Liquid::ArgumentError => e
assert_match(
/\ALiquid error: wrong number of arguments \((1 for 0|given 1, expected 0)\)\z/,
e.message)
assert_equal e.backtrace[0].split(':')[0], __FILE__
end
end
def test_strainer_only_invokes_public_filter_methods
strainer = Strainer.create(nil)
assert_equal false, strainer.class.invokable?('__test__')