summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2025-02-26 11:13:41 +0900
committerNobuyoshi Nakada <[email protected]>2025-02-26 11:13:41 +0900
commit14192921f5eda76efa85a97ed3f1bfbf48e9a534 (patch)
treeeb26b2371c5269c549bf2e10d7c37dc08ce6a157 /spec
parent2194e65a98444c1c8fc71c9835000378df18e59c (diff)
Check LoadError first
The message from dlerror is not our concern.
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/kernel/shared/require.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/spec/ruby/core/kernel/shared/require.rb b/spec/ruby/core/kernel/shared/require.rb
index 080409117f..b31c89e3bf 100644
--- a/spec/ruby/core/kernel/shared/require.rb
+++ b/spec/ruby/core/kernel/shared/require.rb
@@ -223,7 +223,7 @@ describe :kernel_require, shared: true do
it "loads c-extension file when passed absolute path without extension when no .rb is present" do
# the error message is specific to what dlerror() returns
path = File.join CODE_LOADING_DIR, "a", "load_fixture"
- -> { @object.send(@method, path) }.should raise_error(Exception, /file too short|not a mach-o file|slice is not valid mach-o file/)
+ -> { @object.send(@method, path) }.should raise_error(LoadError)
end
end
@@ -231,7 +231,7 @@ describe :kernel_require, shared: true do
it "loads .bundle file when passed absolute path with .so" do
# the error message is specific to what dlerror() returns
path = File.join CODE_LOADING_DIR, "a", "load_fixture.so"
- -> { @object.send(@method, path) }.should raise_error(Exception, /load_fixture\.bundle.+(file too short|not a mach-o file|slice is not valid mach-o file)/)
+ -> { @object.send(@method, path) }.should raise_error(LoadError)
end
end