diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-03-16 19:29:57 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2024-04-05 01:33:08 +0900 |
commit | 58918788abd63901588e4aa1e39b5c057321c10a (patch) | |
tree | 617721fc3c0bdca58942c83b9af95eec0be02ce5 /test/ruby | |
parent | ef19234b1008508cb04048c815088b9359c9d2b6 (diff) |
[Bug #20342] Consider wrapped load in `main` methods
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_require.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 4f636fa1ba..ef33928376 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -370,6 +370,26 @@ class TestRequire < Test::Unit::TestCase end end + def test_public_in_wrapped_load + Tempfile.create(["test_public_in_wrapped_load", ".rb"]) do |t| + t.puts "def foo; end", "public :foo" + t.close + assert_warning(/main\.public/) do + assert load(t.path, true) + end + end + end + + def test_private_in_wrapped_load + Tempfile.create(["test_private_in_wrapped_load", ".rb"]) do |t| + t.puts "def foo; end", "private :foo" + t.close + assert_warning(/main\.private/) do + assert load(t.path, true) + end + end + end + def test_load_scope bug1982 = '[ruby-core:25039] [Bug #1982]' Tempfile.create(["test_ruby_test_require", ".rb"]) {|t| |