summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2023-02-14 12:54:50 -0800
committerGitHub <noreply@github.com>2023-02-14 12:54:50 -0800
commit6c5582815dcd02726354ff407b73aba25b036b74 (patch)
treea12f22abab3469dd57dbcfa66159549d15ffe2a5 /bootstraptest
parent3c7d5ccdce5707d7964f01f974db505d5add590f (diff)
downloadruby-6c5582815dcd02726354ff407b73aba25b036b74.tar.gz
YJIT: Check correct BOP on gen_fixnum_cmp (#7303)
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 66b663b062..ebb19c8d3a 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -374,6 +374,45 @@ assert_equal 'false', %q{
less_than 2
}
+# BOP redefinition works on Integer#<=
+assert_equal 'false', %q{
+ def le(x, y) = x <= y
+
+ le(2, 2)
+
+ class Integer
+ def <=(_) = false
+ end
+
+ le(2, 2)
+}
+
+# BOP redefinition works on Integer#>
+assert_equal 'false', %q{
+ def gt(x, y) = x > y
+
+ gt(3, 2)
+
+ class Integer
+ def >(_) = false
+ end
+
+ gt(3, 2)
+}
+
+# BOP redefinition works on Integer#>=
+assert_equal 'false', %q{
+ def ge(x, y) = x >= y
+
+ ge(2, 2)
+
+ class Integer
+ def >=(_) = false
+ end
+
+ ge(2, 2)
+}
+
# Putobject, less-than operator, fixnums
assert_equal '2', %q{
def check_index(index)