summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/language')
-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