string.c: fix ASCII-only on succ

* string.c (str_succ): clear coderange cache when no alpha-numeric
  character case, carried part may become ASCII-only.
  [ruby-core:83062] [Bug #13952]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2017-09-30 00:01:23 +00:00
parent 623cf29787
commit 16759238ad
2 changed files with 6 additions and 0 deletions

View File

@ -4079,6 +4079,7 @@ str_succ(VALUE str)
}
carry_pos = s - sbeg;
}
ENC_CODERANGE_SET(str, ENC_CODERANGE_UNKNOWN);
}
RESIZE_CAPA(str, slen + carry_len);
sbeg = RSTRING_PTR(str);

View File

@ -1872,6 +1872,11 @@ CODE
assert_equal("!", " ".succ)
assert_equal("", "".succ)
bug = '[ruby-core:83062] [Bug #13952]'
s = "\xff".b
assert_not_predicate(s, :ascii_only?)
assert_predicate(s.succ, :ascii_only?, bug)
end
def test_succ!