Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8459

Show
Ignore:
Timestamp:
12/21/07 11:21:20 (2 years ago)
Author:
bitsweat
Message:

Multibyte: String#chars uses passthrough handler for Ruby 1.9

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activesupport/lib/active_support/multibyte/chars.rb

    r8402 r8459  
    126126      else 
    127127        def utf8_pragma? 
    128           !@string.nil? && (Encoding.default_external == Encoding::UTF_8) 
     128          false 
    129129        end 
    130130      end 
  • trunk/activesupport/Rakefile

    r8438 r8459  
    1717task :default => :test 
    1818Rake::TestTask.new { |t|  
     19  t.libs << "test" 
    1920  t.pattern = 'test/**/*_test.rb' 
    2021  t.verbose = true 
  • trunk/activesupport/test/multibyte_chars_test.rb

    r7273 r8459  
    1 require File.dirname(__FILE__) + '/abstract_unit' 
     1require 'abstract_unit' 
    22 
    3 $KCODE = 'UTF8' 
     3$KCODE = 'UTF8' if RUBY_VERSION < '1.9' 
    44 
    55class CharsTest < Test::Unit::TestCase 
     
    8686    end 
    8787  end 
    88    
     88 
    8989  def test_pragma 
    90     with_kcode('UTF8') do 
    91       assert " ".chars.send(:utf8_pragma?), "UTF8 pragma should be on because KCODE is UTF8" 
    92     end 
    93     with_kcode('none') do 
    94       assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off" 
     90    if RUBY_VERSION < '1.9' 
     91      with_kcode('UTF8') do 
     92        assert " ".chars.send(:utf8_pragma?), "UTF8 pragma should be on because KCODE is UTF8" 
     93      end 
     94      with_kcode('none') do 
     95        assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off because KCODE is not UTF8" 
     96      end 
     97    else 
     98      assert !" ".chars.send(:utf8_pragma?), "UTF8 pragma should be off in Ruby 1.9" 
    9599    end 
    96100  end 
    97    
     101 
    98102  def test_handler_setting 
    99103    handler = ''.chars.handler 
  • trunk/activesupport/test/multibyte_conformance.rb

    r8365 r8459  
    1 require File.dirname(__FILE__) + '/abstract_unit' 
     1require 'abstract_unit' 
    22require 'open-uri' 
    33 
    4 $KCODE = 'UTF8' 
     4$KCODE = 'UTF8' if RUBY_VERSION < '1.9' 
     5 
    56UNIDATA_URL = "http://www.unicode.org/Public/#{ActiveSupport::Multibyte::UNICODE_VERSION}/ucd" 
    67UNIDATA_FILE = '/NormalizationTest.txt' 
  • trunk/activesupport/test/multibyte_handler_test.rb

    r8301 r8459  
    1 require File.dirname(__FILE__) + '/abstract_unit' 
    2  
    3 $KCODE = 'UTF8' 
     1require 'abstract_unit' 
     2 
     3$KCODE = 'UTF8' if RUBY_VERSION < '1.9' 
    44 
    55class String