diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 08:25:01 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-12-10 08:25:01 +0000 |
commit | 38b92f838f0c387807e5f430277af5cd7196cd71 (patch) | |
tree | 52036b7045f1d13db247cf44e99fb77ef939e9db | |
parent | c26e32ec168040c5778dfdd6a435d53ab283a181 (diff) | |
download | ruby-38b92f838f0c387807e5f430277af5cd7196cd71.tar.gz |
* transcode*.[ch], test/ruby/test_transcode.rb: set properties.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | test/ruby/test_transcode.rb | 88 | ||||
-rw-r--r-- | transcode.c | 4 |
2 files changed, 46 insertions, 46 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 2993e2f006..b4c8170a3b 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -1,44 +1,44 @@ -# -*- encoding: US-ASCII -*- # make sure this runs in binary mode
-
-class String
- # different name, because we should be able to remove this later
- def fix_encoding (encoding)
- force_encoding(encoding)
- end
-end
-
-require 'test/unit'
-class TestConvert < Test::Unit::TestCase
- def test_can_call
- # we don't have semantics for conversion without attribute yet
- # maybe 'convert to UTF-8' would be nice :-)
- assert_raise(ArgumentError) { 'abc'.encode }
- assert_raise(ArgumentError) { 'abc'.encode! }
- assert_raise(ArgumentError) { 'abc'.force_encoding('Shift_JIS').encode('UTF-8') } # temporary
- assert_raise(ArgumentError) { 'abc'.force_encoding('Shift_JIS').encode!('UTF-8') } # temporary
- assert_raise(ArgumentError) { 'abc'.encode('foo', 'bar') }
- assert_raise(ArgumentError) { 'abc'.encode!('foo', 'bar') }
- assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode('foo') }
- assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode!('foo') }
- assert_equal('abc'.force_encoding('utf-8').encode('iso-8859-1'), 'abc') # temporary, fix encoding
- assert_equal("D\xFCrst".force_encoding('iso-8859-1').encode('utf-8').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-1').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-2').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-3').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-4').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-9').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-10').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-13').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-14').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-15').fix_encoding('utf-8'), "D\u00FCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-1'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-2'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-3'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-4'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-9'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-10'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-13'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-14'), "D\xFCrst")
- assert_equal("D\u00FCrst".encode('iso-8859-15'), "D\xFCrst")
- end
-end
\ No newline at end of file +# -*- encoding: US-ASCII -*- # make sure this runs in binary mode + +class String + # different name, because we should be able to remove this later + def fix_encoding (encoding) + force_encoding(encoding) + end +end + +require 'test/unit' +class TestConvert < Test::Unit::TestCase + def test_can_call + # we don't have semantics for conversion without attribute yet + # maybe 'convert to UTF-8' would be nice :-) + assert_raise(ArgumentError) { 'abc'.encode } + assert_raise(ArgumentError) { 'abc'.encode! } + assert_raise(ArgumentError) { 'abc'.force_encoding('Shift_JIS').encode('UTF-8') } # temporary + assert_raise(ArgumentError) { 'abc'.force_encoding('Shift_JIS').encode!('UTF-8') } # temporary + assert_raise(ArgumentError) { 'abc'.encode('foo', 'bar') } + assert_raise(ArgumentError) { 'abc'.encode!('foo', 'bar') } + assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode('foo') } + assert_raise(ArgumentError) { 'abc'.force_encoding('utf-8').encode!('foo') } + assert_equal('abc'.force_encoding('utf-8').encode('iso-8859-1'), 'abc') # temporary, fix encoding + assert_equal("D\xFCrst".force_encoding('iso-8859-1').encode('utf-8').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-1').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-2').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-3').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-4').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-9').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-10').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-13').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-14').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\xFCrst".encode('utf-8', 'iso-8859-15').fix_encoding('utf-8'), "D\u00FCrst") + assert_equal("D\u00FCrst".encode('iso-8859-1'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-2'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-3'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-4'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-9'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-10'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-13'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-14'), "D\xFCrst") + assert_equal("D\u00FCrst".encode('iso-8859-15'), "D\xFCrst") + end +end diff --git a/transcode.c b/transcode.c index 697332fa5e..805e9e4a89 100644 --- a/transcode.c +++ b/transcode.c @@ -2,8 +2,8 @@ transcode.c - - $Author: duerst $ - $Date: 2007-10-30 16:10:22 +0900 (Tue, 30 Oct 2007) $ + $Author$ + $Date$ created at: Tue Oct 30 16:10:22 JST 2007 Copyright (C) 2007 Martin Duerst |