summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-30 00:01:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-30 00:01:23 +0000
commit16759238ad5a19e784f73a66ba5cacf7ee274262 (patch)
treeaa0164af378353d944a1d1f61e74f2166133496d
parent623cf29787e8c798f711622450c748ac65f22cea (diff)
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
-rw-r--r--string.c1
-rw-r--r--test/ruby/test_string.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/string.c b/string.c
index e1bd9a052e..0c782a430f 100644
--- a/string.c
+++ b/string.c
@@ -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);
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index ec90193546..75da42eeef 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -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!