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

struct.c: add keyword_init option to Struct.new

to initialize struct with keyword arguments.

[Feature #11925] [close GH-1771]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
k0kubun 2017-12-12 08:12:43 +00:00
parent a679472c0e
commit 02015974a3
3 changed files with 92 additions and 11 deletions

View file

@ -60,7 +60,7 @@ describe "Struct.new" do
lambda { Struct.new(:animal, nil) }.should raise_error(TypeError)
lambda { Struct.new(:animal, true) }.should raise_error(TypeError)
lambda { Struct.new(:animal, ['chris', 'evan']) }.should raise_error(TypeError)
lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(TypeError)
lambda { Struct.new(:animal, { name: 'chris' }) }.should raise_error(ArgumentError)
end
it "raises a TypeError if object is not a Symbol" do