diff options
| author | Andrew Konchin <andry.konchin@gmail.com> | 2024-07-01 15:38:25 +0300 |
|---|---|---|
| committer | Benoit Daloze <eregontp@gmail.com> | 2024-07-02 13:33:48 +0200 |
| commit | cee62c6738c42ce774e96e180cf2d46afb8e9cbe (patch) | |
| tree | 52a37ef94e90f99f8471dbba4d6659ca5dc6c532 /spec/ruby/core/string/encode_spec.rb | |
| parent | d7af8afe1b85b8de04cd77c673b0f6ef3f3627fa (diff) | |
Update to ruby/spec@f8987ac
Diffstat (limited to 'spec/ruby/core/string/encode_spec.rb')
| -rw-r--r-- | spec/ruby/core/string/encode_spec.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/spec/ruby/core/string/encode_spec.rb b/spec/ruby/core/string/encode_spec.rb index 97dd753b62..cd449498a3 100644 --- a/spec/ruby/core/string/encode_spec.rb +++ b/spec/ruby/core/string/encode_spec.rb @@ -61,10 +61,22 @@ describe "String#encode" do str.encode(invalid: :replace).should_not equal(str) end - it "normalizes newlines" do - "\r\nfoo".encode(universal_newline: true).should == "\nfoo" + it "normalizes newlines with cr_newline option" do + "\r\nfoo".encode(cr_newline: true).should == "\r\rfoo" + "\rfoo".encode(cr_newline: true).should == "\rfoo" + "\nfoo".encode(cr_newline: true).should == "\rfoo" + end + it "normalizes newlines with crlf_newline option" do + "\r\nfoo".encode(crlf_newline: true).should == "\r\r\nfoo" + "\rfoo".encode(crlf_newline: true).should == "\rfoo" + "\nfoo".encode(crlf_newline: true).should == "\r\nfoo" + end + + it "normalizes newlines with universal_newline option" do + "\r\nfoo".encode(universal_newline: true).should == "\nfoo" "\rfoo".encode(universal_newline: true).should == "\nfoo" + "\nfoo".encode(universal_newline: true).should == "\nfoo" end it "replaces invalid encoding in source with default replacement" do |
