diff options
author | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2019-04-27 18:53:23 +0200 |
commit | a1b4816759418ca8fe510e8739622fc5d77ab0f0 (patch) | |
tree | 9d4fb6091d0086817f5bde46bf1150e9130d34fd /spec/ruby/core/method | |
parent | 00c33d9c232ed1a79eda17acd7231ac93caa162b (diff) | |
download | ruby-a1b4816759418ca8fe510e8739622fc5d77ab0f0.tar.gz |
Update to ruby/spec@15c9619
Diffstat (limited to 'spec/ruby/core/method')
-rw-r--r-- | spec/ruby/core/method/parameters_spec.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/spec/ruby/core/method/parameters_spec.rb b/spec/ruby/core/method/parameters_spec.rb index 750abe13d0..1de3901040 100644 --- a/spec/ruby/core/method/parameters_spec.rb +++ b/spec/ruby/core/method/parameters_spec.rb @@ -243,17 +243,19 @@ describe "Method#parameters" do end it "returns [[:rest]] for core methods with variable-length argument lists" do - m = "foo" - - # match takes rest args - m.method(:match).parameters.should == [[:rest]] + # delete! takes rest args + "foo".method(:delete!).parameters.should == [[:rest]] + end - # [] takes 1 to 3 args - m.method(:[]).parameters.should == [[:rest]] + it "returns [[:rest]] or [[:opt]] for core methods with optional arguments" do + # pop takes 1 optional argument + [ + [[:rest]], + [[:opt]] + ].should include([].method(:pop).parameters) end it "returns [[:req]] for each parameter for core methods with fixed-length argument lists" do - m = "foo" - m.method(:+).parameters.should == [[:req]] + "foo".method(:+).parameters.should == [[:req]] end end |