Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix issue 2113 StringIO puts printing nil #2129

Merged
merged 2 commits into from

2 participants

@ashmoran

I've had a go at fixing issue #2113. I'm new here, let me know if I got anything wrong and I can change it.

@brixen brixen merged commit 2ddcb4d into rubinius:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
2  lib/19/stringio.rb
@@ -357,7 +357,7 @@ def puts(*args)
else
args.each do |arg|
if arg.nil?
- line = "nil"
+ line = ""
elsif Thread.guarding? arg
line = "[...]"
else
View
2  lib/20/stringio.rb
@@ -357,7 +357,7 @@ def puts(*args)
else
args.each do |arg|
if arg.nil?
- line = "nil"
+ line = ""
elsif Thread.guarding? arg
line = "[...]"
else
View
14 spec/ruby/library/stringio/puts_spec.rb
@@ -91,6 +91,20 @@
@io.puts ''
@io.string.should == "\n"
end
+
+ ruby_version_is ""..."1.9" do
+ it "prints a newline when passed nil" do
+ @io.puts nil
+ @io.string.should == "nil\n"
+ end
+ end
+
+ ruby_version_is "1.9" do
+ it "prints a newline when passed nil" do
+ @io.puts nil
+ @io.string.should == "\n"
+ end
+ end
end
describe "StringIO#puts when passed no arguments" do
Something went wrong with that request. Please try again.