aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/string/chomp_spec.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-11-13 13:17:24 +0100
committerBenoit Daloze <eregontp@gmail.com>2020-11-13 13:17:24 +0100
commit6d05967468ea58ba481259718f07b3cb5a386945 (patch)
treee21976cdae28f91bcac002dc463a099ca64d111d /spec/ruby/core/string/chomp_spec.rb
parentacbe7aa19705905e7ad1952395e98e8bfe583a97 (diff)
downloadruby-6d05967468ea58ba481259718f07b3cb5a386945.tar.gz
Update to ruby/spec@b0b7f53
Diffstat (limited to 'spec/ruby/core/string/chomp_spec.rb')
-rw-r--r--spec/ruby/core/string/chomp_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/string/chomp_spec.rb b/spec/ruby/core/string/chomp_spec.rb
index b3f64d7118..7a1118d534 100644
--- a/spec/ruby/core/string/chomp_spec.rb
+++ b/spec/ruby/core/string/chomp_spec.rb
@@ -55,6 +55,10 @@ describe "String#chomp" do
$/ = "cdef"
"abcdef".chomp.should == "ab"
end
+
+ it "removes one trailing newline for string with invalid encoding" do
+ "\xa0\xa1\n".chomp.should == "\xa0\xa1"
+ end
end
describe "when passed nil" do
@@ -108,6 +112,10 @@ describe "String#chomp" do
it "returns an empty String when self is empty" do
"".chomp("").should == ""
end
+
+ it "removes one trailing newline for string with invalid encoding" do
+ "\xa0\xa1\n".chomp("").should == "\xa0\xa1"
+ end
end
describe "when passed '\\n'" do