summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2021-08-27 18:35:34 -0700
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:40 -0400
commit9ebcd576f367280c60064bc98fe35b1f2fb27e2b (patch)
tree67f9fd10a0bdde06699eef89058cd571e1720597 /bootstraptest
parent6db5e80dd7e91fcfaf55727dbe24619d964cfac4 (diff)
String and fixnum equality
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index 866d7e2558..8ddff90050 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1950,3 +1950,29 @@ assert_equal '42', %q{
ractor.take
}
+
+# Test equality with changing types
+assert_equal '[true, false, false, false]', %q{
+ def eq(a, b)
+ a == b
+ end
+
+ [
+ eq("foo", "foo"),
+ eq("foo", "bar"),
+ eq(:foo, "bar"),
+ eq("foo", :bar)
+ ]
+}
+
+# Redefined eq
+assert_equal 'true', %q{
+ class String
+ def ==(other)
+ true
+ end
+ end
+
+ "foo" == "bar"
+ "foo" == "bar"
+}