-
Notifications
You must be signed in to change notification settings - Fork 187
Make load path cache work on TruffleRuby #450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,16 +35,21 @@ def test_builtin_features | |
assert_equal false, cache.find("thread") | ||
assert_equal false, cache.find("thread.rb") | ||
assert_equal false, cache.find("enumerator") | ||
assert_equal false, cache.find("enumerator.so") | ||
|
||
if RUBY_PLATFORM =~ /darwin/ | ||
assert_equal false, cache.find("enumerator.bundle") | ||
if truffleruby? | ||
assert_equal false, cache.find("enumerator.rb") | ||
else | ||
assert_same FALLBACK_SCAN, cache.find("enumerator.bundle") | ||
assert_equal false, cache.find("enumerator.so") | ||
if RUBY_PLATFORM =~ /darwin/ | ||
assert_equal false, cache.find("enumerator.bundle") | ||
else | ||
assert_same FALLBACK_SCAN, cache.find("enumerator.bundle") | ||
end | ||
end | ||
|
||
bundle = RUBY_PLATFORM =~ /darwin/ ? "bundle" : "so" | ||
|
||
# These are not present in TruffleRuby but that means they will still return falsey. | ||
refute(cache.find("thread.#{bundle}")) | ||
refute(cache.find("enumerator.rb")) | ||
refute(cache.find("encdb.#{bundle}")) | ||
|
@@ -165,9 +170,15 @@ def test_path_encoding | |
require path | ||
internal_path = $LOADED_FEATURES.last | ||
assert_equal(OS_ASCII_PATH_ENCODING, internal_path.encoding) | ||
assert_equal(OS_ASCII_PATH_ENCODING, path.encoding) | ||
# TruffleRuby object is a copy and the encoding resets to utf-8. | ||
assert_equal(OS_ASCII_PATH_ENCODING, path.encoding) unless truffleruby? | ||
File.write(path, "") | ||
assert_same path, internal_path | ||
|
||
if truffleruby? | ||
assert_equal path, internal_path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comparison different from CRuby due to oracle/truffleruby#3138? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no, i haven't filed an issue on truffleruby for it yet, but on CRuby |
||
else | ||
assert_same path, internal_path | ||
end | ||
|
||
utf8_path = cache.find("béé") | ||
assert_equal("#{@dir1}/béé.rb", utf8_path) | ||
|
@@ -176,9 +187,20 @@ def test_path_encoding | |
assert_equal(Encoding::UTF_8, internal_utf8_path.encoding) | ||
assert_equal(Encoding::UTF_8, utf8_path.encoding) | ||
File.write(utf8_path, "") | ||
assert_same utf8_path, internal_utf8_path | ||
|
||
if truffleruby? | ||
assert_equal utf8_path, internal_utf8_path | ||
else | ||
assert_same utf8_path, internal_utf8_path | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def truffleruby? | ||
RUBY_ENGINE == "truffleruby" | ||
end | ||
end | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.