aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/multibyte_chars_test.rb
diff options
context:
space:
mode:
authorGourav Tiwari <gouravtiwari21@gmail.com>2015-06-29 20:20:50 +0000
committerSean Griffin <sean@seantheprogrammer.com>2015-10-20 15:59:57 -0600
commit09b46c7dbea6ac2ac09ba4a41fae0bf628a775f3 (patch)
tree55f60c9529e7237ec1597e955b44d67e1d3b9f73 /activesupport/test/multibyte_chars_test.rb
parent1193824994887fb37ca492d7c5eb1f381f2fc220 (diff)
downloadrails-09b46c7dbea6ac2ac09ba4a41fae0bf628a775f3.tar.gz
rails-09b46c7dbea6ac2ac09ba4a41fae0bf628a775f3.tar.bz2
rails-09b46c7dbea6ac2ac09ba4a41fae0bf628a775f3.zip
Fixed slice! behavior: return nil for out-of-bound parameters
Diffstat (limited to 'activesupport/test/multibyte_chars_test.rb')
-rw-r--r--activesupport/test/multibyte_chars_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index e1c4b705f8..42829c6a8e 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -413,6 +413,10 @@ class MultibyteCharsUTF8BehaviourTest < ActiveSupport::TestCase
assert_equal 'にち', @chars.slice!(1..2)
end
+ def test_slice_bang_returns_nil_on_out_of_bound_arguments
+ assert_equal nil, @chars.mb_chars.slice!(9..10)
+ end
+
def test_slice_bang_removes_the_slice_from_the_receiver
chars = 'úüù'.mb_chars
chars.slice!(0,2)