ruby-changes:4049
From: ko1@a...
Date: Mon, 18 Feb 2008 15:18:47 +0900 (JST)
Subject: [ruby-changes:4049] akr - Ruby:r15539 (trunk): * string.c (rb_str_each_line): fix newline size.
akr 2008-02-18 15:18:31 +0900 (Mon, 18 Feb 2008)
New Revision: 15539
Modified files:
trunk/ChangeLog
trunk/string.c
trunk/test/ruby/test_m17n.rb
Log:
* string.c (rb_str_each_line): fix newline size.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/string.c?r1=15539&r2=15538&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15539&r2=15538&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_m17n.rb?r1=15539&r2=15538&diff_format=u
Index: ChangeLog
===================================================================
--- ChangeLog (revision 15538)
+++ ChangeLog (revision 15539)
@@ -1,3 +1,7 @@
+Mon Feb 18 15:16:30 2008 Tanaka Akira <akr@f...>
+
+ * string.c (rb_str_each_line): fix newline size.
+
Mon Feb 18 13:06:37 2008 Tanaka Akira <akr@f...>
* lib/irb/locale.rb (IRB::Locale#lc2kconv): check ja_JP.EUC-JP as well.
Index: string.c
===================================================================
--- string.c (revision 15538)
+++ string.c (revision 15539)
@@ -4896,7 +4896,7 @@
p++;
continue;
}
- p = p0 + rb_enc_mbclen(s, p0, enc);
+ p = p0 + rb_enc_mbclen(p0, pend, enc);
line = rb_str_new5(str, s, p - s);
OBJ_INFECT(line, str);
rb_enc_copy(line, str);
Index: test/ruby/test_m17n.rb
===================================================================
--- test/ruby/test_m17n.rb (revision 15538)
+++ test/ruby/test_m17n.rb (revision 15539)
@@ -980,6 +980,12 @@
def test_each_line
s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4")
assert_raise(ArgumentError){s.each_line(a("\xa3\xb1")) {|l| }}
+ s = e("\xa4\xa2\nfoo")
+
+ actual = []
+ s.each_line {|line| actual << line }
+ expected = [e("\xa4\xa2\n"), e("foo")]
+ assert_equal(expected, actual)
end
def test_each_char
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/