diff options
author | John Hawthorn <john@hawthorn.email> | 2021-09-11 23:29:24 -0700 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:40 -0400 |
commit | 5092d6129a9f1d57752a29f4808fe74e1c6a666b (patch) | |
tree | c264ff22042eebf00ed06c4e8754eaac3846c87d /bootstraptest/test_yjit.rb | |
parent | 554d76afb4ca5cf623fb76bde90fce6f87971be8 (diff) |
Fix opt_eq for overridden equality
Diffstat (limited to 'bootstraptest/test_yjit.rb')
-rw-r--r-- | bootstraptest/test_yjit.rb | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb index 8ddff90050..1ff6b13f5c 100644 --- a/bootstraptest/test_yjit.rb +++ b/bootstraptest/test_yjit.rb @@ -1965,7 +1965,7 @@ assert_equal '[true, false, false, false]', %q{ ] } -# Redefined eq +# Redefined String eq assert_equal 'true', %q{ class String def ==(other) @@ -1973,6 +1973,26 @@ assert_equal 'true', %q{ end end - "foo" == "bar" - "foo" == "bar" + def eq(a, b) + a == b + end + + eq("foo", "bar") + eq("foo", "bar") +} + +# Redefined Integer eq +assert_equal 'true', %q{ + class Integer + def ==(other) + true + end + end + + def eq(a, b) + a == b + end + + eq(1, 2) + eq(1, 2) } |