diff options
author | Nobuyoshi Nakada <[email protected]> | 2020-01-11 10:14:53 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2020-01-11 10:42:21 +0900 |
commit | 8bb24712de04cfa8bb1dbfc0c3cee3de6eb4b40d (patch) | |
tree | b50a42ec3971923ffdd4aec007fc0e163f15c751 /test/ruby/test_transcode.rb | |
parent | 52a9e4ffd3c868214ded91592cf12837bc60f80e (diff) |
Added assertions for newline decorators
Diffstat (limited to 'test/ruby/test_transcode.rb')
-rw-r--r-- | test/ruby/test_transcode.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index f405877dd5..3466a3bf93 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -2242,12 +2242,19 @@ class TestTranscode < Test::Unit::TestCase "#{bug} coderange should not have side effects") end - def test_universal_newline + def test_newline_options bug11324 = '[ruby-core:69841] [Bug #11324]' usascii = Encoding::US_ASCII s = "A\nB\r\nC".force_encoding(usascii) assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true), bug11324) assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace), bug11324) assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace, replace: ''), bug11324) + assert_equal("A\nB\nC", s.encode(usascii, newline: :universal)) + assert_equal("A\nB\nC", s.encode(usascii, newline: :universal, undef: :replace)) + assert_equal("A\nB\nC", s.encode(usascii, newline: :universal, undef: :replace, replace: '')) + assert_equal("A\rB\r\rC", s.encode(usascii, cr_newline: true)) + assert_equal("A\rB\r\rC", s.encode(usascii, newline: :cr)) + assert_equal("A\r\nB\r\r\nC", s.encode(usascii, crlf_newline: true)) + assert_equal("A\r\nB\r\r\nC", s.encode(usascii, newline: :crlf)) end end |