summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2021-06-18 19:05:02 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2021-10-20 18:19:36 -0400
commitda20ff1644a274aff4d5ad22c649c85d83e7e311 (patch)
treeb591726cb5ebc3818b861e493edb6888347d4a0d /bootstraptest
parent7d252186fe803aa5e1fa37c953609266a2d8ba1d (diff)
Fix bug in generic case for gen_checktype
When checking for T_HASH, which is Qnil and when the type check succeeds we were outputting to the stack a Qnil instead of a Qtrue.
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_yjit.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/bootstraptest/test_yjit.rb b/bootstraptest/test_yjit.rb
index e15728fd98..da66c06795 100644
--- a/bootstraptest/test_yjit.rb
+++ b/bootstraptest/test_yjit.rb
@@ -1154,6 +1154,26 @@ assert_equal '7', %q{
foo(5,2)
}
+# test pattern matching
+assert_equal '[:ok, :ok]', %q{
+ class C
+ def destructure_keys
+ {}
+ end
+ end
+
+ pattern_match = ->(i) do
+ case i
+ in a: 0
+ :ng
+ else
+ :ok
+ end
+ end
+
+ [{}, C.new].map(&pattern_match)
+}
+
# Call to object with singleton
assert_equal '123', %q{
obj = Object.new