Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ca0d6522e803
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d5dafa43f635
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on May 11, 2016

  1. Add some specs for puts with newline conversion.

    Added to address a frozen string bug #3855.
    headius committed May 11, 2016
    Copy the full SHA
    d70743f View commit details
  2. Copy the full SHA
    d5dafa4 View commit details
Showing with 25 additions and 0 deletions.
  1. +23 −0 spec/ruby/core/io/puts_spec.rb
  2. +2 −0 spec/truffle/tags/core/io/puts_tags.txt
23 changes: 23 additions & 0 deletions spec/ruby/core/io/puts_spec.rb
Original file line number Diff line number Diff line change
@@ -116,4 +116,27 @@ def @io.write(str)
it "raises IOError on closed stream" do
lambda { IOSpecs.closed_io.puts("stuff") }.should raise_error(IOError)
end

with_feature :encoding do
it "writes crlf when IO is opened with newline: :crlf" do
File.open(@name, 'w', newline: :crlf) do |file|
file.puts
end
File.read(@name).should == "\r\n"
end

it "writes cr when IO is opened with newline: :cr" do
File.open(@name, 'w', newline: :cr) do |file|
file.puts
end
File.read(@name).should == "\r"
end

it "writes lf when IO is opened with newline: :lf" do
File.open(@name, 'w', newline: :lf) do |file|
file.puts
end
File.read(@name).should == "\n"
end
end
end
2 changes: 2 additions & 0 deletions spec/truffle/tags/core/io/puts_tags.txt
Original file line number Diff line number Diff line change
@@ -2,3 +2,5 @@ fails:IO#puts writes just a newline when given just a newline
fails:IO#puts calls :to_ary before writing non-string objects, regardless of it being implemented in the receiver
fails:IO#puts calls :to_ary before writing non-string objects
fails:IO#puts returns general object info if :to_s does not return a string
fails:IO#puts writes crlf when IO is opened with newline: :crlf
fails:IO#puts writes cr when IO is opened with newline: :cr