diff options
author | Nobuyoshi Nakada <[email protected]> | 2025-03-13 12:51:04 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <[email protected]> | 2025-03-17 23:42:16 +0900 |
commit | 4c072c811905610a84107fdae103982d144b3d71 () | |
tree | 8a1dc4253cc88975603c8f01477b6393f65b45b9 /tool/lib/core_assertions.rb | |
parent | 8f19f0aad5f87d481b5ae4337afdb844bcce1885 (diff) |
Fix `assert_warning` for `Proc`
`Proc` does not have `encoding` method. Also, make `assert_raise_with_message` accept a `Proc` as the expected pattern, as well.
Notes: Merged: https://.com/ruby/ruby/pull/12923
-rw-r--r-- | tool/lib/core_assertions.rb | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -489,14 +489,13 @@ eom case expected when String assert = :assert_equal - when Regexp - assert = :assert_match else - raise TypeError, "Expected #{expected.inspect} to be a kind of String or Regexp, not #{expected.class}" end ex = m = nil - EnvUtil.with_default_internal(expected.encoding) do ex = assert_raise(exception, msg || proc {"Exception(#{exception}) with message matches to #{expected.inspect}"}) do yield end @@ -670,7 +669,7 @@ eom def assert_warning(pat, msg = nil) result = nil - stderr = EnvUtil.with_default_internal(pat.encoding) { EnvUtil.verbose_warning { result = yield } |