aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/multibyte_chars_test.rb
diff options
context:
space:
mode:
authorMatias Flores <mflores@atlanware.com>2009-09-26 21:32:21 -0300
committerJeremy Kemper <jeremy@bitsweat.net>2009-11-02 17:57:55 -0800
commit23780850237876cf81038534d8f59fa307af0b31 (patch)
tree3865b6755f66be53270ae29e1a06865ae9cd2d0f /activesupport/test/multibyte_chars_test.rb
parente93c2da14108c324ddf5f08f0165b342e028896f (diff)
downloadrails-23780850237876cf81038534d8f59fa307af0b31.tar.gz
rails-23780850237876cf81038534d8f59fa307af0b31.tar.bz2
rails-23780850237876cf81038534d8f59fa307af0b31.zip
Fix chars.reverse for multibyte decomposed strings
[#597 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activesupport/test/multibyte_chars_test.rb')
-rw-r--r--activesupport/test/multibyte_chars_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index 0d3c3c7716..a1ea8c8f4c 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -384,6 +384,17 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
assert_equal 'わちにこ', @chars.reverse
end
+ def test_reverse_should_work_with_normalized_strings
+ str = 'bös'
+ reversed_str = 'söb'
+ assert_equal chars(reversed_str).normalize(:kc), chars(str).normalize(:kc).reverse
+ assert_equal chars(reversed_str).normalize(:c), chars(str).normalize(:c).reverse
+ assert_equal chars(reversed_str).normalize(:d), chars(str).normalize(:d).reverse
+ assert_equal chars(reversed_str).normalize(:kd), chars(str).normalize(:kd).reverse
+ assert_equal chars(reversed_str).decompose, chars(str).decompose.reverse
+ assert_equal chars(reversed_str).compose, chars(str).compose.reverse
+ end
+
def test_slice_should_take_character_offsets
assert_equal nil, ''.mb_chars.slice(0)
assert_equal 'こ', @chars.slice(0)