summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 13:10:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-25 13:10:14 +0000
commit9237049efe48ce61219aeacf855da90e6e7602fb (patch)
treed4cc93322e32c7c4d3b5c9bceeb5361be9ca8d9c /test/ruby/test_string.rb
parent845b3cfbf486f037e93ef520e344c3451e9559fc (diff)
string.c: clear substring code range
* string.c (str_substr): substring of broken code range string may be valid or broken. patch by tommy (Masahiro Tomita) at [ruby-dev:50430] [Bug #14388]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index b0c6e447eb..dd3a0349b5 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -3087,6 +3087,12 @@ CODE
assert_equal("\u3042", "\u3042\u3043".chr)
assert_equal('', ''.chr)
end
+
+ def test_substr_code_range
+ data = "\xff" + "a"*200
+ assert_not_predicate(data, :valid_encoding?)
+ assert_predicate(data[100..-1], :valid_encoding?)
+ end
end
class TestString2 < TestString