diff options
author | Benoit Daloze <eregontp@gmail.com> | 2022-06-26 14:50:14 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2022-06-26 14:50:14 +0200 |
commit | d3d5ef0cca160fca538c7f556c5a6e08df5847e6 (patch) | |
tree | 57358b4b9cdd6f429d0383005ac393cb74dd3bff /spec/ruby/core/string/rstrip_spec.rb | |
parent | f616e816372d14e605879d2e43c7fbdda29ef837 (diff) | |
download | ruby-d3d5ef0cca160fca538c7f556c5a6e08df5847e6.tar.gz |
Update to ruby/spec@ab32a1a
Diffstat (limited to 'spec/ruby/core/string/rstrip_spec.rb')
-rw-r--r-- | spec/ruby/core/string/rstrip_spec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/ruby/core/string/rstrip_spec.rb b/spec/ruby/core/string/rstrip_spec.rb index 2dc55182ae..dc34b12719 100644 --- a/spec/ruby/core/string/rstrip_spec.rb +++ b/spec/ruby/core/string/rstrip_spec.rb @@ -46,4 +46,10 @@ describe "String#rstrip!" do -> { "hello".freeze.rstrip! }.should raise_error(FrozenError) -> { "".freeze.rstrip! }.should raise_error(FrozenError) end + + it "raises an ArgumentError if the last codepoint is invalid" do + s = "abc\xDF".force_encoding(Encoding::UTF_8) + s.valid_encoding?.should be_false + -> { s.rstrip! }.should raise_error(ArgumentError) + end end |