diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-01-23 05:27:25 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-01-23 05:27:25 +0000 |
commit | a44cee2549e04e6e586f0f9432d98bb2dd4e3625 (patch) | |
tree | 1f1f1f37b7bb4a9622fa8407caeef937e0149fd1 /activesupport/test | |
parent | 1bdb14bdd3cad4ae8850040d6d82c3c3c624f224 (diff) | |
download | rails-a44cee2549e04e6e586f0f9432d98bb2dd4e3625.tar.gz rails-a44cee2549e04e6e586f0f9432d98bb2dd4e3625.tar.bz2 rails-a44cee2549e04e6e586f0f9432d98bb2dd4e3625.zip |
ActiveSupport::Multibyte::Handlers::UTF8Handler should raise when a range and an integer are passed in (just like the native implementation). Closes #7176 [Rich Collins]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6021 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/multibyte_handler_test.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activesupport/test/multibyte_handler_test.rb b/activesupport/test/multibyte_handler_test.rb index 95d6faec7c..ea728aa555 100644 --- a/activesupport/test/multibyte_handler_test.rb +++ b/activesupport/test/multibyte_handler_test.rb @@ -162,6 +162,9 @@ module UTF8HandlingTest assert_equal " Блå ffi ", @handler.slice(@string, 4..10), "Unicode characters have to be returned" assert_equal "", @handler.slice(@string, 7..6), "Range is empty, should return an empty string" assert_raise(ActiveSupport::Multibyte::Handlers::EncodingError) { @handler.slice(@bytestring, 2..3) } + assert_raise(TypeError, "With 2 args, should raise TypeError for non-Numeric or Regexp first argument") { @handler.slice(@string, 2..3, 1) } + assert_raise(TypeError, "With 2 args, should raise TypeError for non-Numeric or Regexp second argument") { @handler.slice(@string, 1, 2..3) } + assert_raise(ArgumentError, "Should raise ArgumentError when there are more than 2 args") { @handler.slice(@string, 1, 1, 1) } end def test_grapheme_cluster_length |