mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
use one-line pattern matching for warning tests
This commit is contained in:
parent
b1e7c3a31f
commit
0e33028d69
3 changed files with 5 additions and 7 deletions
|
@ -32,7 +32,7 @@ ruby_version_is "2.7" do
|
||||||
|
|
||||||
describe "The -W command line option with :no-experimental" do
|
describe "The -W command line option with :no-experimental" do
|
||||||
it "suppresses experimental warnings" do
|
it "suppresses experimental warnings" do
|
||||||
result = ruby_exe('case 0; in a; end', args: '2>&1')
|
result = ruby_exe('1 => a', args: '2>&1')
|
||||||
result.should =~ /is experimental/
|
result.should =~ /is experimental/
|
||||||
|
|
||||||
result = ruby_exe('case 0; in a; end', options: '-W:no-experimental', args: '2>&1')
|
result = ruby_exe('case 0; in a; end', options: '-W:no-experimental', args: '2>&1')
|
||||||
|
|
|
@ -8,8 +8,8 @@ ruby_version_is '2.7' do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "emits and suppresses warnings for :experimental" do
|
it "emits and suppresses warnings for :experimental" do
|
||||||
ruby_exe('Warning[:experimental] = true; eval("case 0; in a; end")', args: "2>&1").should =~ /is experimental/
|
ruby_exe('Warning[:experimental] = true; eval("1 => a")', args: "2>&1").should =~ /is experimental/
|
||||||
ruby_exe('Warning[:experimental] = false; eval("case 0; in a; end")', args: "2>&1").should == ""
|
ruby_exe('Warning[:experimental] = false; eval("1 => a")', args: "2>&1").should == ""
|
||||||
end
|
end
|
||||||
|
|
||||||
it "raises for unknown category" do
|
it "raises for unknown category" do
|
||||||
|
|
|
@ -41,11 +41,9 @@ ruby_version_is "2.7" do
|
||||||
it "warns about pattern matching is experimental feature" do
|
it "warns about pattern matching is experimental feature" do
|
||||||
-> {
|
-> {
|
||||||
eval <<~RUBY
|
eval <<~RUBY
|
||||||
case 0
|
1 => a
|
||||||
in 0
|
|
||||||
end
|
|
||||||
RUBY
|
RUBY
|
||||||
}.should complain(/warning: Pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
|
}.should complain(/warning: One-line pattern matching is experimental, and the behavior may change in future versions of Ruby!/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "binds variables" do
|
it "binds variables" do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue