mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@cdd6ff7
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
49cd16bfaf
commit
50441014ff
102 changed files with 771 additions and 426 deletions
|
@ -130,6 +130,17 @@ describe "Struct.new" do
|
|||
it "fails with too many arguments" do
|
||||
lambda { StructClasses::Ruby.new('2.0', 'i686', true) }.should raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it "passes a hash as a normal argument" do
|
||||
type = Struct.new(:args)
|
||||
|
||||
obj = type.new(keyword: :arg)
|
||||
obj2 = type.new(*[{keyword: :arg}])
|
||||
|
||||
obj.should == obj2
|
||||
obj.args.should == {keyword: :arg}
|
||||
obj2.args.should == {keyword: :arg}
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.5" do
|
||||
|
@ -163,6 +174,12 @@ describe "Struct.new" do
|
|||
@struct_with_kwa.new("elefant", 4)
|
||||
}.should raise_error(ArgumentError, /wrong number of arguments/)
|
||||
end
|
||||
|
||||
it "raises ArgumentError when passed a single non-hash argument" do
|
||||
-> {
|
||||
@struct_with_kwa.new("elefant")
|
||||
}.should raise_error(ArgumentError, /wrong number of arguments/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue