summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSatoshi Tagomori <[email protected]>2025-04-30 13:48:02 +0900
committerSatoshi Tagomori <[email protected]>2025-05-11 23:32:50 +0900
commit382645d440d5da66a0c04557f3ff2ca226de3a27 ()
treeb7453449930197237e739d0985561b664f51b0f3 /test
parent49742414f6444960838bb968bab43db27f5872c1 (diff)
namespace on read
-rw-r--r--test/-ext-/namespace/test_load_ext.rb97
-rw-r--r--test/-ext-/test_abi.rb12
-rw-r--r--test/ruby/namespace/a.1_1_0.rb17
-rw-r--r--test/ruby/namespace/a.1_2_0.rb17
-rw-r--r--test/ruby/namespace/a.rb15
-rw-r--r--test/ruby/namespace/autoloading.rb8
-rw-r--r--test/ruby/namespace/blank.rb2
-rw-r--r--test/ruby/namespace/blank1.rb2
-rw-r--r--test/ruby/namespace/blank2.rb2
-rw-r--r--test/ruby/namespace/call_proc.rb5
-rw-r--r--test/ruby/namespace/call_toplevel.rb8
-rw-r--r--test/ruby/namespace/consts.rb147
-rw-r--r--test/ruby/namespace/current.rb13
-rw-r--r--test/ruby/namespace/define_toplevel.rb5
-rw-r--r--test/ruby/namespace/global_vars.rb37
-rw-r--r--test/ruby/namespace/line_splitter.rb9
-rw-r--r--test/ruby/namespace/load_path.rb26
-rw-r--r--test/ruby/namespace/ns.rb10
-rw-r--r--test/ruby/namespace/open_class_with_include.rb31
-rw-r--r--test/ruby/namespace/proc_callee.rb14
-rw-r--r--test/ruby/namespace/proc_caller.rb5
-rw-r--r--test/ruby/namespace/procs.rb64
-rw-r--r--test/ruby/namespace/raise.rb3
-rw-r--r--test/ruby/namespace/returns_proc.rb12
-rw-r--r--test/ruby/namespace/singleton_methods.rb65
-rw-r--r--test/ruby/namespace/string_ext.rb13
-rw-r--r--test/ruby/namespace/string_ext_caller.rb5
-rw-r--r--test/ruby/namespace/string_ext_calling.rb1
-rw-r--r--test/ruby/namespace/string_ext_eval_caller.rb12
-rw-r--r--test/ruby/namespace/top_level.rb33
-rw-r--r--test/ruby/test_autoload.rb18
-rw-r--r--test/ruby/test_namespace.rb516
-rw-r--r--test/ruby/test_rubyoptions.rb2
33 files changed, 1222 insertions, 4 deletions
@@ -0,0 +1,97 @@
@@ -9,7 +9,11 @@ class TestABI < Test::Unit::TestCase
assert_separately [], <<~RUBY
err = assert_raise(LoadError) { require "-test-/abi" }
assert_match(/incompatible ABI version/, err.message)
- assert_include err.message, "/-test-/abi."
RUBY
end
@@ -27,7 +31,11 @@ class TestABI < Test::Unit::TestCase
assert_separately [{ "RUBY_ABI_CHECK" => "1" }], <<~RUBY
err = assert_raise(LoadError) { require "-test-/abi" }
assert_match(/incompatible ABI version/, err.message)
- assert_include err.message, "/-test-/abi."
RUBY
end
@@ -0,0 +1,17 @@
@@ -0,0 +1,17 @@
@@ -0,0 +1,15 @@
@@ -0,0 +1,8 @@
@@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
@@ -0,0 +1,5 @@
@@ -0,0 +1,8 @@
@@ -0,0 +1,147 @@
@@ -0,0 +1,13 @@
@@ -0,0 +1,5 @@
@@ -0,0 +1,37 @@
@@ -0,0 +1,9 @@
@@ -0,0 +1,26 @@
@@ -0,0 +1,10 @@
@@ -0,0 +1,31 @@
@@ -0,0 +1,14 @@
@@ -0,0 +1,5 @@
@@ -0,0 +1,64 @@
@@ -0,0 +1,3 @@
@@ -0,0 +1,12 @@
@@ -0,0 +1,65 @@
@@ -0,0 +1,13 @@
@@ -0,0 +1,5 @@
@@ -0,0 +1 @@
@@ -0,0 +1,12 @@
@@ -0,0 +1,33 @@
@@ -224,11 +224,18 @@ p Foo::Bar
Kernel.module_eval do
alias old_require require
end
called_with = []
Kernel.send :define_method, :require do |path|
called_with << path
old_require path
end
yield called_with
ensure
Kernel.module_eval do
@@ -236,6 +243,11 @@ p Foo::Bar
alias require old_require
undef old_require
end
end
def test_require_implemented_in_ruby_is_called
@@ -249,7 +261,8 @@ p Foo::Bar
ensure
remove_autoload_constant
end
- assert_equal [file.path], called_with
}
end
end
@@ -267,7 +280,8 @@ p Foo::Bar
ensure
remove_autoload_constant
end
- assert_equal [a.path, b.path], called_with
end
end
end
@@ -0,0 +1,516 @@
@@ -260,6 +260,8 @@ class TestRubyOptions < Test::Unit::TestCase
end
def test_parser_flag
assert_in_out_err(%w(--parser=prism -e) + ["puts :hi"], "", %w(hi), [])
assert_in_out_err(%w(--parser=prism --dump=parsetree -e _=:hi), "", /"hi"/, [])