mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 01:23:57 +02:00
Pass the called keyword arguments if keyword_init
This commit is contained in:
parent
215e4b8721
commit
431132f037
Notes:
git
2019-10-21 15:30:27 +09:00
2 changed files with 19 additions and 6 deletions
|
@ -112,6 +112,10 @@ module TestStruct
|
|||
assert_equal @Struct::KeywordInitTrue.new(a: 1, b: 2).values, @Struct::KeywordInitFalse.new(1, 2).values
|
||||
assert_equal "#{@Struct}::KeywordInitFalse", @Struct::KeywordInitFalse.inspect
|
||||
assert_equal "#{@Struct}::KeywordInitTrue(keyword_init: true)", @Struct::KeywordInitTrue.inspect
|
||||
k = Class.new(@Struct::KeywordInitFalse) {def initialize(**) end}
|
||||
assert_warn(/The last argument is used as the keyword parameter/) {k.new(a: 1, b: 2)}
|
||||
k = Class.new(@Struct::KeywordInitTrue) {def initialize(**) end}
|
||||
assert_warn('') {k.new(a: 1, b: 2)}
|
||||
|
||||
@Struct.instance_eval do
|
||||
remove_const(:KeywordInitTrue)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue