diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2024-05-29 15:40:49 -0700 |
|---|---|---|
| committer | Takashi Kokubun <takashikkbn@gmail.com> | 2024-05-29 15:40:49 -0700 |
| commit | a24f19742bfa398a3b32c51df01133db7bcbc6e0 (patch) | |
| tree | c23e09cc613dfb8b2c060f0e91c91ca4b17c7135 /test/ruby | |
| parent | 72a45ac7a3cc9bbecf641ac505f8ee791c9da48c (diff) | |
merge revision(s) 58918788abd63901588e4aa1e39b5c057321c10a: [Backport #20342]
[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 fd5092aaf0..871912e491 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| |
