From 2e9b95e3560e6b315117f88ee99add0c271b8cbd Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Thu, 6 Jun 2024 18:06:13 -0500 Subject: [PATCH] Add a case for failed Hash pattern match This is not tested elsewhere and was found to be broken in JRuby's JIT in jruby/jruby#8283. --- language/pattern_matching_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/language/pattern_matching_spec.rb b/language/pattern_matching_spec.rb index 7ccf15eb5..bfeeaf16a 100644 --- a/language/pattern_matching_spec.rb +++ b/language/pattern_matching_spec.rb @@ -261,6 +261,12 @@ def o.evaled end RUBY }.should raise_error(NoMatchingPatternError, /\[0, 1\]/) + + -> { + case {a: 0, b: 1} + in a: 1, b: 1 + end + }.should raise_error(NoMatchingPatternError, /\{:a=>0, :b=>1\}/) end it "raises NoMatchingPatternError if no pattern matches and evaluates the expression only once" do