String#chomp misbehaving in 1.1b1
---------------------------------
Key: JRUBY-1532
URL: http://jira.codehaus.org/browse/JRUBY-1532
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1b1
Environment: Linux 2.6.22 with Java 5
Reporter: Matt Fletcher
Attachments: test_chomp_removes_newlines_in_funky_string.rb
Since JRuby 1.1 beta is out, I decided to run my test suite (developed against
JRuby 1.0) with it. I've revealed at least one test failure: some code that was
responsible for splitting up some records, input as one big string blob, is now
having trouble chomping out newlines. Attached is a single test case, similar
to my real test, highlighting the problem. This test passes against C Ruby and
JRuby 1.0; I have not tried it with JRuby 1.0.1, 1.0.2, or trunk.
I personally have not looked into what makes the second line fail but not the
first; perhaps it is the length of the line, the number of characters in that
first field, or some weird interaction between map and chomp. I have no idea
nor any suggestions. I just hope it can be fixed so that I can more to 1.1
eventually. :)
Paste of test case:
==============
class Chomper
def chomp_it(lines)
lines.map { |line| line.chomp }
end
end
require "test/unit"
class ChompingTest < Test::Unit::TestCase
def test_chomp_removes_newlines_in_funky_string
chomper = Chomper.new
first_funky_string = "a|b|c|\nd|e|f|\ng|h|i|"
assert_equal %w[ a|b|c| d|e|f| g|h|i| ],
chomper.chomp_it(first_funky_string)
second_funky_string = "aa|b|c|\nd|e|f|\ng|h|i|"
assert_equal %w[ aa|b|c| d|e|f| g|h|i| ],
chomper.chomp_it(second_funky_string)
end
end
==============
Paste of JRuby 1.1b1 output minus the test/unit stacktrace:
==============
Loaded suite test_chomp_removes_newlines_in_funky_string
Started
F
Finished in 0.911 seconds.
1) Failure:
test_chomp_removes_newlines_in_funky_string(ChompingTest)
[spammy test/unit stacktrace removed]
<["aa|b|c|", "d|e|f|", "g|h|i|"]> expected but was
<["aa|b|c|", "d|e|f|\n", "g|h|i|"]>.
1 tests, 2 assertions, 1 failures, 0 errors
==============
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email