Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/warning/warn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ def Warning.warn(msg)

ruby_version_is "3.4" do
it "warns when category is :strict_unused_block but Warning[:strict_unused_block] is false" do
warn_experimental = Warning[:strict_unused_block]
warn_strict_unused_block = Warning[:strict_unused_block]
Warning[:strict_unused_block] = true
begin
-> {
Warning.warn("foo", category: :strict_unused_block)
}.should complain("foo")
ensure
Warning[:strict_unused_block] = warn_experimental
Warning[:strict_unused_block] = warn_strict_unused_block
end
end
end
Expand Down Expand Up @@ -137,14 +137,14 @@ def Warning.warn(msg)

ruby_version_is "3.4" do
it "doesn't print message when category is :strict_unused_block but Warning[:strict_unused_block] is false" do
warn_experimental = Warning[:strict_unused_block]
warn_strict_unused_block = Warning[:strict_unused_block]
Warning[:strict_unused_block] = false
begin
-> {
Warning.warn("foo", category: :strict_unused_block)
}.should_not complain
ensure
Warning[:strict_unused_block] = warn_experimental
Warning[:strict_unused_block] = warn_strict_unused_block
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions language/method_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1621,12 +1621,12 @@ def m_that_does_not_use_block
# ensure that warning is emitted
-> { m_that_does_not_use_block { } }.should complain(verbose: true)

warn_experimental = Warning[:strict_unused_block]
warn_strict_unused_block = Warning[:strict_unused_block]
Warning[:strict_unused_block] = false
begin
-> { m_that_does_not_use_block { } }.should_not complain(verbose: true)
ensure
Warning[:strict_unused_block] = warn_experimental
Warning[:strict_unused_block] = warn_strict_unused_block
end
end

Expand All @@ -1635,14 +1635,14 @@ def m_that_does_not_use_block
42
end

warn_experimental = Warning[:strict_unused_block]
warn_strict_unused_block = Warning[:strict_unused_block]
Warning[:strict_unused_block] = true
begin
-> {
m_that_does_not_use_block { }
}.should complain(/the block passed to 'm_that_does_not_use_block' defined at .+ may be ignored/)
ensure
Warning[:strict_unused_block] = warn_experimental
Warning[:strict_unused_block] = warn_strict_unused_block
end
end
end
Expand Down