diff options
| author | Jeremy Evans <code@jeremyevans.net> | 2023-12-12 16:58:20 -0800 |
|---|---|---|
| committer | Jeremy Evans <code@jeremyevans.net> | 2023-12-13 07:05:21 -0800 |
| commit | 0d53dba7ce900387397610c060cfa24758fc806a (patch) | |
| tree | 194209543de6a4a1212a21a9db225f96bab20fe9 /test/ruby | |
| parent | c42e4a38e9839fe3380566727304f3fd75a6506a (diff) | |
Make String#chomp! raise ArgumentError for 2+ arguments if string is empty
String#chomp! returned nil without checking the number of passed
arguments in this case.
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_string.rb | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 42553cba82..1c7e085630 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -587,6 +587,8 @@ CODE assert_equal("foo", s.chomp!("\n")) s = "foo\r" assert_equal("foo", s.chomp!("\n")) + + assert_raise(ArgumentError) {String.new.chomp!("", "")} ensure $/ = save $VERBOSE = verbose |
