summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_ast.rb9
-rw-r--r--test/ruby/test_jit.rb7
-rw-r--r--test/ruby/test_method.rb36
-rw-r--r--test/ruby/test_refinement.rb2
-rw-r--r--test/ruby/test_syntax.rb13
5 files changed, 3 insertions, 64 deletions
diff --git a/test/ruby/test_ast.rb b/test/ruby/test_ast.rb
index a4c18d0ad6..4c156650b8 100644
--- a/test/ruby/test_ast.rb
+++ b/test/ruby/test_ast.rb
@@ -264,15 +264,6 @@ class TestAst < Test::Unit::TestCase
assert_equal(:SCOPE, defn.type)
end
- def test_methref
- node = RubyVM::AbstractSyntaxTree.parse("obj.:foo")
- _, _, body = *node.children
- assert_equal(:METHREF, body.type)
- recv, mid = body.children
- assert_equal(:VCALL, recv.type)
- assert_equal(:foo, mid)
- end
-
def test_dstr
node = parse('"foo#{1}bar"')
_, _, body = *node.children
diff --git a/test/ruby/test_jit.rb b/test/ruby/test_jit.rb
index 803a8e4996..3ef60df7a1 100644
--- a/test/ruby/test_jit.rb
+++ b/test/ruby/test_jit.rb
@@ -482,13 +482,6 @@ class TestJIT < Test::Unit::TestCase
end;
end
- def test_compile_insn_methodref
- assert_compile_once("#{<<~"begin;"}\n#{<<~'end;'}", result_inspect: '"main"', insns: %i[methodref])
- begin;
- self.:inspect.call
- end;
- end
-
def test_compile_insn_inlinecache
assert_compile_once('Struct', result_inspect: 'Struct', insns: %i[opt_getinlinecache opt_setinlinecache])
end
diff --git a/test/ruby/test_method.rb b/test/ruby/test_method.rb
index 1a1ac59334..afab7eb900 100644
--- a/test/ruby/test_method.rb
+++ b/test/ruby/test_method.rb
@@ -1125,42 +1125,6 @@ class TestMethod < Test::Unit::TestCase
}
end
- def test_method_reference_operator
- m = 1.:succ
- assert_predicate(m, :frozen?)
- assert_equal(1.method(:succ), m)
- assert_equal(2, m.())
- m = 1.:+
- assert_predicate(m, :frozen?)
- assert_equal(1.method(:+), m)
- assert_equal(42, m.(41))
- m = 1.:-@
- assert_predicate(m, :frozen?)
- assert_equal(1.method(:-@), m)
- assert_equal(-1, m.())
- o = Object.new
- def o.foo; 42; end
- assert_predicate(o.:foo, :frozen?)
- m = o.method(:foo)
- assert_equal(m, o.:foo)
- def o.method(m); nil; end
- assert_equal(m, o.:foo)
- assert_nil(o.method(:foo))
- end
-
- def test_method_reference_freeze_state
- m = 1.:succ
- assert_predicate(m, :frozen?, "dot-symbol method reference should be frozen")
- m = 1.method(:succ)
- assert_not_predicate(m, :frozen?, "#method method reference should not be frozen")
- o = Object.new
- def o.foo; 42; end
- m = o.:foo
- assert_predicate(m, :frozen?, "dot-symbol method reference should be frozen")
- m = o.method(:foo)
- assert_not_predicate(m, :frozen?, "#method method reference should not be frozen")
- end
-
def test_umethod_bind_call
foo = Base.instance_method(:foo)
assert_equal(:base, foo.bind_call(Base.new))
diff --git a/test/ruby/test_refinement.rb b/test/ruby/test_refinement.rb
index 4be0720983..34451de482 100644
--- a/test/ruby/test_refinement.rb
+++ b/test/ruby/test_refinement.rb
@@ -235,7 +235,7 @@ class TestRefinement < Test::Unit::TestCase
meth.call(3)
EOS
assert_equal(:refine_pow, eval_using(MethodIntegerPowEx, "2.pow(3)"))
- assert_equal(:refine_pow, eval_using(MethodIntegerPowEx, "2.:pow.(3)"))
+ assert_equal(:refine_pow, eval_using(MethodIntegerPowEx, "2.method(:pow).(3)"))
end
module InstanceMethodIntegerPowEx
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 622017be83..286beb7074 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -93,13 +93,6 @@ class TestSyntax < Test::Unit::TestCase
assert_valid_syntax("tap (proc do end)", __FILE__, bug9726)
end
- def test_methodref_literal
- assert_separately [], <<-EOS
- eval 'nil.:|;1'
- 1000.times{eval 'nil.:|;1'}
- EOS
- end
-
def test_array_kwsplat_hash
kw = {}
h = {a: 1}
@@ -1014,10 +1007,8 @@ eom
def test_fluent_dot
assert_valid_syntax("a\n.foo")
assert_valid_syntax("a\n&.foo")
- assert_valid_syntax("a\n.:foo")
assert_valid_syntax("a #\n#\n.foo\n")
assert_valid_syntax("a #\n#\n&.foo\n")
- assert_valid_syntax("a #\n#\n.:foo\n")
end
def test_safe_call_in_massign_lhs
@@ -1534,8 +1525,8 @@ eom
assert_warning(/\A\z|:(?!#{__LINE__+1})\d+: #{warning}/o) {
assert_equal([[], {}], obj.foo({}))
}
- assert_equal(-1, obj.:foo.arity)
- parameters = obj.:foo.parameters
+ assert_equal(-1, obj.method(:foo).arity)
+ parameters = obj.method(:foo).parameters
assert_equal(:rest, parameters.dig(0, 0))
assert_equal(:block, parameters.dig(1, 0))
end