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:
parent
a679472c0e
commit
02015974a3
3 changed files with 92 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue