diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-11 10:14:53 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-01-11 10:42:21 +0900 |
commit | 8bb24712de04cfa8bb1dbfc0c3cee3de6eb4b40d (patch) | |
tree | b50a42ec3971923ffdd4aec007fc0e163f15c751 /test/ruby/test_econv.rb | |
parent | 52a9e4ffd3c868214ded91592cf12837bc60f80e (diff) |
Added assertions for newline decorators
Diffstat (limited to 'test/ruby/test_econv.rb')
-rw-r--r-- | test/ruby/test_econv.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_econv.rb b/test/ruby/test_econv.rb index a469614d84..caa0fca8b7 100644 --- a/test/ruby/test_econv.rb +++ b/test/ruby/test_econv.rb @@ -912,6 +912,19 @@ class TestEncodingConverter < Test::Unit::TestCase assert_raise_with_message(ArgumentError, /\u{3042}/) { Encoding::Converter.new("", "", newline: "\u{3042}".to_sym) } + newlines = %i[universal_newline crlf_newline cr_newline] + (2..newlines.size).each do |i| + newlines.combination(i) do |opts| + assert_raise(Encoding::ConverterNotFoundError, "#{opts} are mutually exclusive") do + Encoding::Converter.new("", "", **opts.inject({}) {|o,nl|o[nl]=true;o}) + end + end + end + newlines.each do |nl| + opts = {newline: :universal, nl => true} + ec2 = Encoding::Converter.new("", "", **opts) + assert_equal(ec1, ec2) + end end def test_default_external |