Skip to content

Commit

Permalink
Merge pull request #2196 from herwinw/kernel_warn_with_verbose_nil
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m authored Jul 8, 2024
2 parents 41be89d + 9a5cd9f commit 657f4bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 4 additions & 6 deletions spec/core/kernel/warn_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@
end

it "does not call #write on $stderr if $VERBOSE is nil" do
NATFIXME 'does not call #write on $stderr if $VERBOSE is nil', exception: SpecFailedException do
-> {
$VERBOSE = nil
warn("this is some simple text")
}.should output(nil, "")
end
-> {
$VERBOSE = nil
warn("this is some simple text")
}.should output(nil, "")
end

it "writes each argument on a line when passed multiple arguments" do
Expand Down
1 change: 1 addition & 0 deletions src/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def rand(*args)
end

def warn(*msgs, category: nil, uplevel: nil)
return if $VERBOSE.nil?
if !category.nil? && !category.is_a?(Symbol)
category = category.to_sym if category.respond_to?(:to_sym)
raise TypeError, "no implicit conversion of #{category.class} into Symbol" unless category.is_a?(Symbol)
Expand Down

0 comments on commit 657f4bc

Please sign in to comment.