Skip to content

Commit

Permalink
add spec Warning[category] = true|false to emit/suppress warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lxxxvi committed Oct 22, 2020
1 parent 2642d55 commit 6cd1314
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/warning/warn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@ def Warning.warn(msg)
end
end

ruby_version_is '2.7' do
it "emits and suppresses warnings for :deprecated" do
ruby_exe(%{Warning[:deprecated] = true; $; = ""}, args: "2>&1").should =~ /is deprecated/
ruby_exe(%{Warning[:deprecated] = false; $; = ""}, args: "2>&1").should == ""
end

it "emits and suppresses warnings for :experimental" do
ruby_exe(%{Warning[:experimental] = true; 0 in a}, args: "2>&1").should =~ /is experimental/
ruby_exe(%{Warning[:experimental] = false; 0 in a}, args: "2>&1").should == ""
end
end

ruby_version_is '3.0' do
it "is called by Kernel.warn with nil category keyword" do
Expand Down

0 comments on commit 6cd1314

Please sign in to comment.