* string.c (chopped_length): get rid of unexpected exception.
see [ruby-core:26336]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25512 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ed58a66fa8
commit
121d15ddda
@ -1,3 +1,8 @@
|
|||||||
|
Tue Oct 27 16:36:52 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* string.c (chopped_length): get rid of unexpected exception.
|
||||||
|
see [ruby-core:26336].
|
||||||
|
|
||||||
Tue Oct 27 15:53:10 2009 Tanaka Akira <akr@fsij.org>
|
Tue Oct 27 15:53:10 2009 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* gc.h (SET_MACHINE_STACK_END): use __i386.
|
* gc.h (SET_MACHINE_STACK_END): use __i386.
|
||||||
|
4
string.c
4
string.c
@ -5925,9 +5925,9 @@ chopped_length(VALUE str)
|
|||||||
if (beg > end) return 0;
|
if (beg > end) return 0;
|
||||||
p = rb_enc_prev_char(beg, end, end, enc);
|
p = rb_enc_prev_char(beg, end, end, enc);
|
||||||
if (!p) return 0;
|
if (!p) return 0;
|
||||||
if (p > beg && rb_enc_codepoint(p, end, enc) == '\n') {
|
if (p > beg && rb_enc_ascget(p, end, 0, enc) == '\n') {
|
||||||
p2 = rb_enc_prev_char(beg, p, end, enc);
|
p2 = rb_enc_prev_char(beg, p, end, enc);
|
||||||
if (p2 && rb_enc_codepoint(p2, end, enc) == '\r') p = p2;
|
if (p2 && rb_enc_ascget(p2, end, 0, enc) == '\r') p = p2;
|
||||||
}
|
}
|
||||||
return p - beg;
|
return p - beg;
|
||||||
}
|
}
|
||||||
|
@ -727,15 +727,6 @@ class TestM17NComb < Test::Unit::TestCase
|
|||||||
STRINGS.each {|s|
|
STRINGS.each {|s|
|
||||||
s = s.dup
|
s = s.dup
|
||||||
desc = "#{encdump s}.chop"
|
desc = "#{encdump s}.chop"
|
||||||
if !s.valid_encoding?
|
|
||||||
#assert_raise(ArgumentError, desc) { s.chop }
|
|
||||||
begin
|
|
||||||
s.chop
|
|
||||||
rescue ArgumentError
|
|
||||||
e = $!
|
|
||||||
end
|
|
||||||
next if e
|
|
||||||
end
|
|
||||||
t = nil
|
t = nil
|
||||||
assert_nothing_raised(desc) { t = s.chop }
|
assert_nothing_raised(desc) { t = s.chop }
|
||||||
assert(t.valid_encoding?) if s.valid_encoding?
|
assert(t.valid_encoding?) if s.valid_encoding?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user