1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use the dedicated assertion

This commit is contained in:
Nobuyoshi Nakada 2021-01-17 21:55:48 +09:00
parent 54c91185c9
commit f96eaf54a2
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6

View file

@ -352,8 +352,8 @@ module TestStruct
def test_keyword_args_warning
warning = /warning: Passing only keyword arguments to Struct#initialize will behave differently from Ruby 3\.2\./
assert_match(warning, EnvUtil.verbose_warning { assert_equal({a: 1}, @Struct.new(:a).new(a: 1).a) })
assert_match(warning, EnvUtil.verbose_warning { assert_equal({a: 1}, @Struct.new(:a, keyword_init: nil).new(a: 1).a) })
assert_warn(warning) { assert_equal({a: 1}, @Struct.new(:a).new(a: 1).a) }
assert_warn(warning) { assert_equal({a: 1}, @Struct.new(:a, keyword_init: nil).new(a: 1).a) }
assert_warn('') { assert_equal({a: 1}, @Struct.new(:a).new({a: 1}).a) }
assert_warn('') { assert_equal({a: 1}, @Struct.new(:a, :b).new(1, a: 1).b) }
assert_warn('') { assert_equal(1, @Struct.new(:a, keyword_init: true).new(a: 1).a) }