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

Fri Dec 28 01:55:04 2007 Martin Duerst <duerst@it.aoyama.ac.jp>

* transcode.c (transcode_dispatch): reverted some of the changes
          in r14746.

	* transcode.c, enc/trans/single_byte.c: Added conversions to/from
	  US-ASCII and ASCII-8BIT (using data tables).

	* enc/trans/single_byte.c: Some spacing/ordering changes due to
	  automatic data file generation.

	* transcode_data.h, transcode.c: Preliminary code for using
	  micro-conversion functions.

	* test/ruby/test_transcode.rb: Added some tests for US-ASCII and
	  ASCII-8BIT conversions.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
duerst 2007-12-28 09:26:55 +00:00
parent 48af602e38
commit 793e9423cd
5 changed files with 152 additions and 51 deletions

View file

@ -26,6 +26,8 @@ class TestTranscode < Test::Unit::TestCase
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_raise(RuntimeError) { "\x80".encode('utf-8','ASCII-8BIT') }
assert_raise(RuntimeError) { "\x80".encode('utf-8','US-ASCII') }
assert_raise(RuntimeError) { "\xA5".encode('utf-8','iso-8859-3') }
end
@ -87,6 +89,7 @@ class TestTranscode < Test::Unit::TestCase
def test_ascii_range
encodings = [
'US-ASCII', 'ASCII-8BIT',
'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-3',
'ISO-8859-4', 'ISO-8859-5', 'ISO-8859-6',
'ISO-8859-7', 'ISO-8859-8', 'ISO-8859-9',