diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-21 08:42:10 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-21 08:42:10 +0000 |
commit | 6d5ef97a32f74917efaa53049815873c4ae00aa1 (patch) | |
tree | 580ec0cb8820acc1f4ac67c47b1dfc735e2ae802 /test | |
parent | ca22f3e168dc16cda7b88cb257ce4298782e46b2 (diff) | |
download | ruby-6d5ef97a32f74917efaa53049815873c4ae00aa1.tar.gz |
Thu Feb 21 17:15:15 2008 Martin Duerst <duerst@it.aoyama.ac.jp>
* transcode.c: Added basic support for passing options to String#encode
via a hash. Currently only one option, with one value, is supported:
invalid: :ignore (dropping invalid byte sequences instead of
producing an error). Option naming is not yet stable!
* test/ruby/test_transcode.rb: Added a single test for invalid: :ignore
option. Not more tests because most data does not yet distinguish
between INVALID and UNKNOWN.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_transcode.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index 957d852c19..9edf30882b 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -19,8 +19,6 @@ class TestTranscode < Test::Unit::TestCase end def test_errors - # 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'.encode('foo', 'bar') } @@ -241,4 +239,9 @@ class TestTranscode < Test::Unit::TestCase check_utf_32_both_ways("\u{8FF00}", "\x00\x08\xFF\x00") check_utf_32_both_ways("\u{F00FF}", "\x00\x0F\x00\xFF") end + + def test_invalid_ignore + # arguments only + 'abc'.encode('utf-8', invalid: :ignore) + end end |