1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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
This commit is contained in:
Jeremy Kemper 2007-12-21 11:21:20 +00:00
parent 2556e67403
commit 909b2c1acf
5 changed files with 21 additions and 15 deletions

View file

@ -16,6 +16,7 @@ RUBY_FORGE_USER = "webster132"
task :default => :test
Rake::TestTask.new { |t|
t.libs << "test"
t.pattern = 'test/**/*_test.rb'
t.verbose = true
t.warning = true

View file

@ -125,7 +125,7 @@ module ActiveSupport::Multibyte #:nodoc:
end
else
def utf8_pragma?
!@string.nil? && (Encoding.default_external == Encoding::UTF_8)
false
end
end
end

View file

@ -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
@ -87,11 +87,15 @@ class CharsTest < Test::Unit::TestCase
end
def test_pragma
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"
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

View file

@ -1,7 +1,8 @@
require File.dirname(__FILE__) + '/abstract_unit'
require 'abstract_unit'
require 'open-uri'
$KCODE = 'UTF8'
$KCODE = 'UTF8' if RUBY_VERSION < '1.9'
UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::UNICODE_VERSION}/ucd"
UNIDATA_FILE = '/NormalizationTest.txt'
CACHE_DIR = File.dirname(__FILE__) + '/cache'

View file

@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/abstract_unit'
require 'abstract_unit'
$KCODE = 'UTF8'
$KCODE = 'UTF8' if RUBY_VERSION < '1.9'
class String
# Unicode Inspect returns the codepoints of the string in hex