Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Test String#each_line when separator is longer than the string. #151

Closed
wants to merge 1 commit into from

2 participants

@headius

For JRUBY-6819 we had a bug when the separator string is longer than the string on which you call each_line that caused it to walk off the end. There did not appear to be a test that covered this in MRI's suite.

@tenderlove
Collaborator

Huh. Thanks @headius. I'll merge this in.

@tenderlove
Collaborator

Committed in r36648. Thanks!

@tenderlove tenderlove closed this
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.
Showing with 7 additions and 0 deletions.
  1. +7 −0 test/ruby/test_string.rb
View
7 test/ruby/test_string.rb
@@ -637,6 +637,13 @@ def test_each_line
assert_equal(S("hello!"), res[0])
assert_equal(S("world"), res[1])
+ $/ = "ab"
+
+ res=[]
+ S("a").lines.each {|x| res << x}
+ assert_equal(1, res.size)
+ assert_equal(S("a"), res[0])
+
$/ = save
s = nil
Something went wrong with that request. Please try again.