diff options
author | Jeremy Evans <[email protected]> | 2021-06-18 16:05:15 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2022-08-19 20:23:36 -0700 |
commit | 6f3857f6a7b3cd6bd7e62e4efdbb1b841544e053 (patch) | |
tree | 5ce491f01d0b3f48b4f795bc5735afac3d5fd2ab /test/ruby/test_transcode.rb | |
parent | 1a2f99275be28fb0e8ff4cfc0165966e99898d70 (diff) |
Support Encoding::Converter newline: :lf and :lf_newline options
Previously, newline: :lf was accepted but ignored. Where it
should have been used was commented out code that didn't work,
but unlike all other invalid values, using newline: :lf did
not raise an error.
This adds support for newline: :lf and :lf_newline, for consistency
with newline: :cr and :cr_newline. This is basically the same as
universal_newline, except that it only affects writing and not
reading due to RUBY_ECONV_NEWLINE_DECORATOR_WRITE_MASK.
Add tests for the File.open :newline option while here.
Fixes [Bug #12436]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4590
Diffstat (limited to 'test/ruby/test_transcode.rb')
-rw-r--r-- | test/ruby/test_transcode.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb index c8b0034e06..73737be0ad 100644 --- a/test/ruby/test_transcode.rb +++ b/test/ruby/test_transcode.rb @@ -2305,5 +2305,7 @@ class TestTranscode < Test::Unit::TestCase 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)) + assert_equal("A\nB\nC", s.encode(usascii, lf_newline: true)) + assert_equal("A\nB\nC", s.encode(usascii, newline: :lf)) end end |