summaryrefslogtreecommitdiff
path: root/spec/ruby/command_line
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/command_line')
-rw-r--r--spec/ruby/command_line/dash_upper_w_spec.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/spec/ruby/command_line/dash_upper_w_spec.rb b/spec/ruby/command_line/dash_upper_w_spec.rb
index 40e8fba75bb..62c617b892c 100644
--- a/spec/ruby/command_line/dash_upper_w_spec.rb
+++ b/spec/ruby/command_line/dash_upper_w_spec.rb
@@ -31,11 +31,21 @@ ruby_version_is "2.7" do
end
describe "The -W command line option with :no-experimental" 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 "suppresses experimental warnings" do
- result = ruby_exe('1 => a', args: '2>&1')
+ result = ruby_exe(@src, args: '2>&1')
result.should =~ /is experimental/
- result = ruby_exe('case 0; in a; end', options: '-W:no-experimental', args: '2>&1')
+ result = ruby_exe(@src, options: '-W:no-experimental', args: '2>&1')
result.should == ""
end
end