Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[Truffle] Pulled in Kernel#warn from Rubinius.
  • Loading branch information
nirvdrum committed Feb 19, 2015
1 parent c3a7c5a commit 8324dc4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/kernel/warn_tags.txt
@@ -1,9 +1,5 @@
fails:Kernel#warn is a private method
fails:Kernel#warn requires multiple arguments
fails:Kernel#warn does not append line-end if last character is line-end
fails:Kernel#warn calls #write on $stderr if $VERBOSE is true
fails:Kernel#warn calls #write on $stderr if $VERBOSE is false
fails:Kernel#warn does not call #write on $stderr if $VERBOSE is nil
fails:Kernel#warn writes each argument on a line when passed multiple arguments
fails:Kernel#warn does not write strings when passed no arguments
fails:Kernel#warn writes the default record separator and NOT $/ to $stderr after the warning message
6 changes: 6 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/kernel.rb
Expand Up @@ -128,4 +128,10 @@ def trap(sig, prc=nil, &block)
end
module_function :trap

def warn(*messages)
$stderr.puts(*messages) if !$VERBOSE.nil? && !messages.empty?
nil
end
module_function :warn

end
3 changes: 2 additions & 1 deletion truffle/src/main/ruby/core/shims.rb
Expand Up @@ -65,9 +65,10 @@ def sync=(value)
end

STDERR = IO.new
$stderr = STDERR

class << STDERR
def self.puts(*values)
def puts(*values)
Kernel.send(:puts, *values)
end
end
Expand Down

0 comments on commit 8324dc4

Please sign in to comment.