summaryrefslogtreecommitdiff
path: root/spec/ruby/language/pattern_matching_spec.rb
diff options
context:
space:
mode:
authorKazuki Tsujimoto <kazuki@callcc.net>2020-11-01 17:24:36 +0900
committerKazuki Tsujimoto <kazuki@callcc.net>2020-11-01 17:37:03 +0900
commite0e2492cd30eb76f084f189060de9a79d619f16e (patch)
tree3113d307ef41e188d9b64178e1b9dba5f2c67984 /spec/ruby/language/pattern_matching_spec.rb
parente03e1982bdc2d815298b211d44534908d79aec4e (diff)
Fix Rubyspec (ruby-2.7) failures
https://github.com/ruby/ruby/runs/1337845174
Diffstat (limited to 'spec/ruby/language/pattern_matching_spec.rb')
-rw-r--r--spec/ruby/language/pattern_matching_spec.rb20
1 files changed, 14 insertions, 6 deletions
diff --git a/spec/ruby/language/pattern_matching_spec.rb b/spec/ruby/language/pattern_matching_spec.rb
index e653b54840..6eefcf5ab6 100644
--- a/spec/ruby/language/pattern_matching_spec.rb
+++ b/spec/ruby/language/pattern_matching_spec.rb
@@ -38,12 +38,20 @@ ruby_version_is "2.7" do
RUBY
end
- it "warns about pattern matching is experimental feature" do
- -> {
- eval <<~RUBY
- 1 => a
- RUBY
- }.should complain(/warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
+ describe "warning" do
+ before do
+ ruby_version_is ""..."3.0" do
+ @src = 'case 0; in a; end'
+ end
+
+ ruby_version_is "3.0" do
+ @src = '1 => a'
+ end
+ end
+
+ it "warns about pattern matching is experimental feature" do
+ -> { eval @src }.should complain(/pattern matching is experimental, and the behavior may change in future versions of Ruby!/i)
+ end
end
it "binds variables" do