[ruby/yarp] Fix assert_raises in YARP
https://github.com/ruby/yarp/commit/8f8f3530aa
This commit is contained in:
parent
ae41bdac1e
commit
a52ac350cc
@ -3,37 +3,37 @@
|
||||
require_relative "test_helper"
|
||||
|
||||
module YARP
|
||||
class PatternTest < Test::Unit::TestCase
|
||||
class PatternTest < TestCase
|
||||
def test_invalid_syntax
|
||||
assert_raises(Pattern::CompilationError) { scan("", "<>") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "<>") }
|
||||
end
|
||||
|
||||
def test_invalid_constant
|
||||
assert_raises(Pattern::CompilationError) { scan("", "Foo") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "Foo") }
|
||||
end
|
||||
|
||||
def test_invalid_nested_constant
|
||||
assert_raises(Pattern::CompilationError) { scan("", "Foo::Bar") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "Foo::Bar") }
|
||||
end
|
||||
|
||||
def test_regexp_with_interpolation
|
||||
assert_raises(Pattern::CompilationError) { scan("", "/\#{foo}/") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "/\#{foo}/") }
|
||||
end
|
||||
|
||||
def test_string_with_interpolation
|
||||
assert_raises(Pattern::CompilationError) { scan("", '"#{foo}"') }
|
||||
assert_raise(Pattern::CompilationError) { scan("", '"#{foo}"') }
|
||||
end
|
||||
|
||||
def test_symbol_with_interpolation
|
||||
assert_raises(Pattern::CompilationError) { scan("", ":\"\#{foo}\"") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", ":\"\#{foo}\"") }
|
||||
end
|
||||
|
||||
def test_invalid_node
|
||||
assert_raises(Pattern::CompilationError) { scan("", "IntegerNode[^foo]") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "IntegerNode[^foo]") }
|
||||
end
|
||||
|
||||
def test_self
|
||||
assert_raises(Pattern::CompilationError) { scan("", "self") }
|
||||
assert_raise(Pattern::CompilationError) { scan("", "self") }
|
||||
end
|
||||
|
||||
def test_array_pattern_no_constant
|
||||
|
@ -19,6 +19,10 @@ module YARP
|
||||
class TestCase < ::Test::Unit::TestCase
|
||||
private
|
||||
|
||||
def assert_raises(*args, &block)
|
||||
raise "Use assert_raise instead"
|
||||
end
|
||||
|
||||
def assert_equal_nodes(expected, actual, compare_location: true, parent: nil)
|
||||
assert_equal expected.class, actual.class
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user