aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/Rakefile1
-rw-r--r--activesupport/lib/active_support/multibyte/chars.rb2
-rw-r--r--activesupport/test/multibyte_chars_test.rb22
-rw-r--r--activesupport/test/multibyte_conformance.rb7
-rw-r--r--activesupport/test/multibyte_handler_test.rb4
5 files changed, 21 insertions, 15 deletions
diff --git a/activesupport/Rakefile b/activesupport/Rakefile
index fd8e596772..005792b987 100644
--- a/activesupport/Rakefile
+++ b/activesupport/Rakefile
@@ -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
diff --git a/activesupport/lib/active_support/multibyte/chars.rb b/activesupport/lib/active_support/multibyte/chars.rb
index b30214d947..2427f8c692 100644
--- a/activesupport/lib/active_support/multibyte/chars.rb
+++ b/activesupport/lib/active_support/multibyte/chars.rb
@@ -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
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
diff --git a/activesupport/test/multibyte_conformance.rb b/activesupport/test/multibyte_conformance.rb
index dede3e561d..fdcfda383f 100644
--- a/activesupport/test/multibyte_conformance.rb
+++ b/activesupport/test/multibyte_conformance.rb
@@ -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'
@@ -138,4 +139,4 @@ class ConformanceTestPure < Test::Unit::TestCase
def setup
@handler = ::ActiveSupport::Multibyte::Handlers::UTF8Handler
end
-end \ No newline at end of file
+end
diff --git a/activesupport/test/multibyte_handler_test.rb b/activesupport/test/multibyte_handler_test.rb
index 3384a1a0d4..f61176886b 100644
--- a/activesupport/test/multibyte_handler_test.rb
+++ b/activesupport/test/multibyte_handler_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 String
# Unicode Inspect returns the codepoints of the string in hex