Skip to content

Commit 56a28a1

Browse files
authored
Fix test target code of module_function (#1316)
The test target code was wrong. `module_function` is only available inside module, not inside class. `module_function` is `undef`ed in Class. ```ruby Class.undefined_instance_methods => [:prepend_features, :extend_object, :refine, :module_function, :append_features] ```
1 parent 1471ea3 commit 56a28a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

test/rdoc/test_rdoc_parser_prism_ruby.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,17 +1023,17 @@ class A
10231023

10241024
def test_module_function
10251025
util_parser <<~RUBY
1026-
class A
1026+
module A
10271027
def m1; end
10281028
def m2; end
10291029
def m3; end
10301030
module_function :m1, :m3
10311031
module_function def m4; end
10321032
end
10331033
RUBY
1034-
klass = @store.find_class_named 'A'
1035-
instance_methods = klass.method_list.reject(&:singleton)
1036-
singleton_methods = klass.method_list.select(&:singleton)
1034+
mod = @store.find_module_named 'A'
1035+
instance_methods = mod.method_list.reject(&:singleton)
1036+
singleton_methods = mod.method_list.select(&:singleton)
10371037
if accept_legacy_bug?
10381038
instance_methods.last.visibility = :private
10391039
singleton_methods << singleton_methods.last.dup

0 commit comments

Comments
 (0)