Skip to content

Commit 8f63a1a

Browse files
committed
Add spec for proc with post args and not enough given arguments
1 parent 7fbe4cd commit 8f63a1a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spec/ruby/language/block_spec.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,14 +873,20 @@ def m(a) yield a end
873873
end.call(1, 2, 3).should == [[], 1, 2, 3]
874874
end
875875

876-
it "are required" do
876+
it "are required for a lambda" do
877877
-> {
878878
-> *a, b do
879879
[a, b]
880880
end.call
881881
}.should raise_error(ArgumentError)
882882
end
883883

884+
it "are assigned to nil when not enough arguments are given to a proc" do
885+
proc do |a, *b, c|
886+
[a, b, c]
887+
end.call.should == [nil, [], nil]
888+
end
889+
884890
describe "with required args" do
885891

886892
it "gathers remaining args in the splat" do

0 commit comments

Comments
 (0)