summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-08-30 19:23:10 -0700
committerJeremy Evans <code@jeremyevans.net>2019-08-30 19:25:46 -0700
commit3463e83192215c36bdcebad8be907eaa09593a41 (patch)
tree8289f8b226d72dc1540827229bfbfbb53282180f /spec
parent6424d316b993ecceb6f583ae476096274e304788 (diff)
Warn for keyword to last hash parameter when method has no optional/rest parameters
Previously, there was no warning in this case, even though we will be changing the behavior in Ruby 3. Fixes [Bug #14130]
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/language/method_spec.rb16
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/ruby/language/method_spec.rb b/spec/ruby/language/method_spec.rb
index 41c8268f83..410dba99e2 100644
--- a/spec/ruby/language/method_spec.rb
+++ b/spec/ruby/language/method_spec.rb
@@ -717,7 +717,9 @@ describe "A method" do
ruby
m(1, b: 2).should == [1, 2]
- -> { m("a" => 1, b: 2) }.should raise_error(ArgumentError)
+ suppress_keyword_warning.call do
+ -> { m("a" => 1, b: 2) }.should raise_error(ArgumentError)
+ end
end
evaluate <<-ruby do
@@ -726,7 +728,9 @@ describe "A method" do
m(2).should == [2, 1]
m(1, b: 2).should == [1, 2]
- m("a" => 1, b: 2).should == [{"a" => 1, b: 2}, 1]
+ suppress_keyword_warning.call do
+ m("a" => 1, b: 2).should == [{"a" => 1, b: 2}, 1]
+ end
end
evaluate <<-ruby do
@@ -735,7 +739,9 @@ describe "A method" do
m(1).should == 1
m(1, a: 2, b: 3).should == 1
- m("a" => 1, b: 2).should == {"a" => 1, b: 2}
+ suppress_keyword_warning.call do
+ m("a" => 1, b: 2).should == {"a" => 1, b: 2}
+ end
end
evaluate <<-ruby do
@@ -744,7 +750,9 @@ describe "A method" do
m(1).should == [1, {}]
m(1, a: 2, b: 3).should == [1, {a: 2, b: 3}]
- m("a" => 1, b: 2).should == [{"a" => 1, b: 2}, {}]
+ suppress_keyword_warning.call do
+ m("a" => 1, b: 2).should == [{"a" => 1, b: 2}, {}]
+ end
end
evaluate <<-ruby do