-
Notifications
You must be signed in to change notification settings - Fork 46
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
Skip specs failing on TruffleRuby #121
Changes from 2 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 |
---|---|---|
|
@@ -202,11 +202,13 @@ def test_alternative_pattern | |
end | ||
end | ||
|
||
unless RUBY_ENGINE == "truffleruby" | ||
assert_syntax_error(%q{ | ||
case 0 | ||
in a | 0 | ||
end | ||
}, /illegal variable in alternative pattern/) | ||
end | ||
end | ||
|
||
def test_var_pattern | ||
|
@@ -1281,9 +1283,9 @@ def test_deconstruct_keys | |
end | ||
|
||
# https://github.com/jruby/jruby/issues/7854 | ||
unless defined?(JRUBY_VERSION) | ||
unless defined?(JRUBY_VERSION) || RUBY_ENGINE == "truffleruby" | ||
assert_block do | ||
case {} | ||
case C.new({}) | ||
in {} | ||
C.keys == nil | ||
end | ||
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. I suppose it's a bug in https://github.com/ruby/ruby/blob/master/test/ruby/test_pattern_matching.rb that was hidden - 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. Good catch! Yeah, having 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. The fix in the Ruby repo - ruby/ruby#10757 |
||
|
@@ -1555,7 +1557,7 @@ def deconstruct | |
end | ||
|
||
# Ruby 2.7 doesn't have cache | ||
unless RUBY_VERSION =~ /^2\.7\./ | ||
unless RUBY_VERSION =~ /^2\.7\./ || RUBY_ENGINE == "truffleruby" | ||
|
||
def test_deconstruct_cache | ||
assert_block do | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW this test case differs a bit from the one in the
ruby/spec
repository. Not sure if it's done intentionally. Here the test relies on a way how CRuby accesses array elements - with#[]
method. Theruby/spec
's current version doesn't redefine the#[]
method:This version passes on TruffleRuby but the version with overridden
#[]
- doesn't.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the change to
ruby/spec
was made for TruffleRuby: ruby/spec@0e04268Unfortunately, there are no additional details on that change.
MRI uses
#[]
(oropt_aref
) to access elements returned by#deconstruct
. So, you can do smth like this:I don't know if it's an intended feature or not; @k-tsj could you please take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@palkan
Yes, it's intentional. If
#[]
is redefined, it should be called,.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@k-tsj Thank you!
@eregon ^ That's what I mentioned yesterday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I'm not sure it's a good idea to have that behavior in Ruby, maybe something to discuss on ruby-core.
Subclassing Array and redefining
[]
on its own is already clearly a bad idea, so it seems a niche edge case no one should use.