aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/multibyte_chars_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-20 16:02:31 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-20 16:05:16 -0600
commitb945de3662105abe330cad6e18962ccf7438150b (patch)
tree4651bcff93af8b47c56f25509125f1a6d5cbbeb3 /activesupport/test/multibyte_chars_test.rb
parent09b46c7dbea6ac2ac09ba4a41fae0bf628a775f3 (diff)
downloadrails-b945de3662105abe330cad6e18962ccf7438150b.tar.gz
rails-b945de3662105abe330cad6e18962ccf7438150b.tar.bz2
rails-b945de3662105abe330cad6e18962ccf7438150b.zip
Update #20737 to address feedback
Given that this pull request affects a mutable value, we need to test for and document the affects on the receiver in this case. Additionally, this pull request was missing a CHANGELOG entry.
Diffstat (limited to 'activesupport/test/multibyte_chars_test.rb')
-rw-r--r--activesupport/test/multibyte_chars_test.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index 42829c6a8e..8d4d9d736c 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -423,6 +423,14 @@ class MultibyteCharsUTF8BehaviourTest < ActiveSupport::TestCase
assert_equal 'ù', chars
end
+ def test_slice_bang_returns_nil_and_does_not_modify_receiver_if_out_of_bounds
+ string = 'úüù'
+ chars = string.mb_chars
+ assert_nil chars.slice!(4, 5)
+ assert_equal 'úüù', chars
+ assert_equal 'úüù', string
+ end
+
def test_slice_should_throw_exceptions_on_invalid_arguments
assert_raise(TypeError) { @chars.slice(2..3, 1) }
assert_raise(TypeError) { @chars.slice(1, 2..3) }