diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-21 12:20:19 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-10-21 15:30:00 +0900 |
commit | 431132f037aecc8c9bc783fea257db653c4f8cb0 (patch) | |
tree | 6d1041c8a9ce98b2e622b43f9f514403ca3037db /test/ruby/test_struct.rb | |
parent | 215e4b8721d968b83c66c253e6da15b90520f679 (diff) | |
download | ruby-431132f037aecc8c9bc783fea257db653c4f8cb0.tar.gz |
Pass the called keyword arguments if `keyword_init`
Diffstat (limited to 'test/ruby/test_struct.rb')
-rw-r--r-- | test/ruby/test_struct.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb index 6ba28153e9..ec7728b197 100644 --- a/test/ruby/test_struct.rb +++ b/test/ruby/test_struct.rb @@ -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) |