From 909b2c1acf2eb18b7a75a8cb8af0154fc948fb01 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Fri, 21 Dec 2007 11:21:20 +0000 Subject: Multibyte: String#chars uses passthrough handler for Ruby 1.9 git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8459 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/multibyte_chars_test.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'activesupport/test/multibyte_chars_test.rb') diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb index 6e87ea8851..e8493f4708 100644 --- a/activesupport/test/multibyte_chars_test.rb +++ b/activesupport/test/multibyte_chars_test.rb @@ -1,6 +1,6 @@ -require File.dirname(__FILE__) + '/abstract_unit' +require 'abstract_unit' -$KCODE = 'UTF8' +$KCODE = 'UTF8' if RUBY_VERSION < '1.9' class CharsTest < Test::Unit::TestCase @@ -85,16 +85,20 @@ class CharsTest < Test::Unit::TestCase "Non-matching regular expressions should return nil") end end - + def test_pragma - with_kcode('UTF8') do - assert " ".chars.send(:utf8_pragma?), "UTF8 pragma should be on because KCODE is UTF8" - end - with_kcode('none') do - assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off" + if RUBY_VERSION < '1.9' + with_kcode('UTF8') do + assert " ".chars.send(:utf8_pragma?), "UTF8 pragma should be on because KCODE is UTF8" + end + with_kcode('none') do + assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off because KCODE is not UTF8" + end + else + assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off in Ruby 1.9" end end - + def test_handler_setting handler = ''.chars.handler -- cgit v1.2.3