diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-28 23:20:11 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-28 23:20:11 +0200 |
commit | 79671ec57e59091260a0bc3d40a31d31d9c72a94 (patch) | |
tree | 2f59a8727b8f63f9e79d50352fa4f78a7cc00234 /spec/ruby/core/string/chomp_spec.rb | |
parent | 994833085ae06afbe94d30ab183d80e0234fbe14 (diff) | |
download | ruby-79671ec57e59091260a0bc3d40a31d31d9c72a94.tar.gz |
Update to ruby/spec@7de852d
Diffstat (limited to 'spec/ruby/core/string/chomp_spec.rb')
-rw-r--r-- | spec/ruby/core/string/chomp_spec.rb | 88 |
1 files changed, 43 insertions, 45 deletions
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb index d6ad710382..7400d71336 100644 --- a/spec/ruby/core/string/chomp_spec.rb +++ b/spec/ruby/core/string/chomp_spec.rb @@ -330,62 +330,60 @@ describe "String#chomp!" do end end -with_feature :encoding do - describe "String#chomp" do - before :each do - @before_separator = $/ - end +describe "String#chomp" do + before :each do + @before_separator = $/ + end - after :each do - $/ = @before_separator - end + after :each do + $/ = @before_separator + end - it "does not modify a multi-byte character" do - "あれ".chomp.should == "あれ" - end + it "does not modify a multi-byte character" do + "あれ".chomp.should == "あれ" + end - it "removes the final carriage return, newline from a multibyte String" do - "あれ\r\n".chomp.should == "あれ" - end + it "removes the final carriage return, newline from a multibyte String" do + "あれ\r\n".chomp.should == "あれ" + end - it "removes the final carriage return, newline from a non-ASCII String" do - str = "abc\r\n".encode "utf-32be" - str.chomp.should == "abc".encode("utf-32be") - end + it "removes the final carriage return, newline from a non-ASCII String" do + str = "abc\r\n".encode "utf-32be" + str.chomp.should == "abc".encode("utf-32be") + end - it "removes the final carriage return, newline from a non-ASCII String when the record separator is changed" do - $/ = "\n".encode("utf-8") - str = "abc\r\n".encode "utf-32be" - str.chomp.should == "abc".encode("utf-32be") - end + it "removes the final carriage return, newline from a non-ASCII String when the record separator is changed" do + $/ = "\n".encode("utf-8") + str = "abc\r\n".encode "utf-32be" + str.chomp.should == "abc".encode("utf-32be") end +end - describe "String#chomp!" do - before :each do - @before_separator = $/ - end +describe "String#chomp!" do + before :each do + @before_separator = $/ + end - after :each do - $/ = @before_separator - end + after :each do + $/ = @before_separator + end - it "returns nil when the String is not modified" do - "あれ".chomp!.should be_nil - end + it "returns nil when the String is not modified" do + "あれ".chomp!.should be_nil + end - it "removes the final carriage return, newline from a multibyte String" do - "あれ\r\n".chomp!.should == "あれ" - end + it "removes the final carriage return, newline from a multibyte String" do + "あれ\r\n".chomp!.should == "あれ" + end - it "removes the final carriage return, newline from a non-ASCII String" do - str = "abc\r\n".encode "utf-32be" - str.chomp!.should == "abc".encode("utf-32be") - end + it "removes the final carriage return, newline from a non-ASCII String" do + str = "abc\r\n".encode "utf-32be" + str.chomp!.should == "abc".encode("utf-32be") + end - it "removes the final carriage return, newline from a non-ASCII String when the record separator is changed" do - $/ = "\n".encode("utf-8") - str = "abc\r\n".encode "utf-32be" - str.chomp!.should == "abc".encode("utf-32be") - end + it "removes the final carriage return, newline from a non-ASCII String when the record separator is changed" do + $/ = "\n".encode("utf-8") + str = "abc\r\n".encode "utf-32be" + str.chomp!.should == "abc".encode("utf-32be") end end |