mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test/ruby/test_ast.rb: Avoid a "method redefined" warning
This commit is contained in:
parent
26c9ef6a89
commit
1c72c95d99
1 changed files with 6 additions and 6 deletions
|
@ -258,25 +258,25 @@ class TestAst < Test::Unit::TestCase
|
|||
keep_script_lines_back = RubyVM.keep_script_lines
|
||||
RubyVM.keep_script_lines = true
|
||||
|
||||
method = self.method(eval("def example_method_#{$$}; end"))
|
||||
method = self.method(eval("def example_method_#{$$}_with_keep_script_lines; end"))
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = self.method(eval("def self.example_singleton_method_#{$$}; end"))
|
||||
method = self.method(eval("def self.example_singleton_method_#{$$}_with_keep_script_lines; end"))
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = eval("proc{}")
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = self.method(eval("singleton_class.define_method(:example_define_method_#{$$}){}"))
|
||||
method = self.method(eval("singleton_class.define_method(:example_define_method_#{$$}_with_keep_script_lines){}"))
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = self.method(eval("define_singleton_method(:example_dsm_#{$$}){}"))
|
||||
method = self.method(eval("define_singleton_method(:example_dsm_#{$$}_with_keep_script_lines){}"))
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = eval("Class.new{def example_method; end}.instance_method(:example_method)")
|
||||
method = eval("Class.new{def example_method_with_keep_script_lines; end}.instance_method(:example_method_with_keep_script_lines)")
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
method = eval("Class.new{def example_method; end}.instance_method(:example_method)")
|
||||
method = eval("Class.new{def example_method_with_keep_script_lines; end}.instance_method(:example_method_with_keep_script_lines)")
|
||||
assert_instance_of(RubyVM::AbstractSyntaxTree::Node, RubyVM::AbstractSyntaxTree.of(method))
|
||||
|
||||
ensure
|
||||
|
|
Loading…
Reference in a new issue