summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-01 01:44:36 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-09-01 01:52:48 +0900
commit431a99b5569e90dd76677be273ad81640ce7e757 (patch)
tree2c56208cbf94671c2f5377c0121dd332eed863f0 /test
parentd4eef04883104c6b4618a843651584cb65c9428d (diff)
downloadruby-431a99b5569e90dd76677be273ad81640ce7e757.tar.gz
Split warning messages for tag-jump
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_keyword.rb40
-rw-r--r--test/ruby/test_syntax.rb2
2 files changed, 21 insertions, 21 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb
index 000f55744d..b27b5dc596 100644
--- a/test/ruby/test_keyword.rb
+++ b/test/ruby/test_keyword.rb
@@ -22,7 +22,7 @@ class TestKeywordArguments < Test::Unit::TestCase
def test_f2
assert_equal([:xyz, "foo", 424242], f2(:xyz))
- assert_warn(/The keyword argument for `f2' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `f2'/m) do
assert_equal([{"bar"=>42}, "foo", 424242], f2("bar"=>42))
end
end
@@ -206,16 +206,16 @@ class TestKeywordArguments < Test::Unit::TestCase
f = ->(a, **x) { [a,x] }
assert_raise(ArgumentError) { f[**{}] }
- assert_warn(/The keyword argument for `\[\]' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `\[\]'/m) do
assert_equal([{}, {}], f[**kw])
end
- assert_warn(/The keyword argument for `\[\]' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `\[\]'/m) do
assert_equal([h, {}], f[**h])
end
- assert_warn(/The keyword argument for `\[\]' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `\[\]'/m) do
assert_equal([h2, {}], f[**h2])
end
- assert_warn(/The keyword argument for `\[\]' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `\[\]'/m) do
assert_equal([h3, {}], f[**h3])
end
@@ -353,22 +353,22 @@ class TestKeywordArguments < Test::Unit::TestCase
bug7665 = '[ruby-core:51278]'
bug8463 = '[ruby-core:55203] [Bug #8463]'
expect = [*%w[foo bar], {zzz: 42}]
- assert_warn(/The last argument for `rest_keyrest' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `rest_keyrest'/m) do
assert_equal(expect, rest_keyrest(*expect), bug7665)
end
pr = proc {|*args, **opt| next *args, opt}
- assert_warn(/The last argument for `call' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `call'/m) do
assert_equal(expect, pr.call(*expect), bug7665)
end
- assert_warn(/The last argument for `call' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `call'/m) do
assert_equal(expect, pr.call(expect), bug8463)
end
pr = proc {|a, *b, **opt| next a, *b, opt}
- assert_warn(/The last argument for `call' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `call'/m) do
assert_equal(expect, pr.call(expect), bug8463)
end
pr = proc {|a, **opt| next a, opt}
- assert_warn(/The last argument for `call' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `call'/m) do
assert_equal(expect.values_at(0, -1), pr.call(expect), bug8463)
end
end
@@ -386,13 +386,13 @@ class TestKeywordArguments < Test::Unit::TestCase
end
def test_keyword_split
- assert_warn(/The keyword argument for `req_plus_keyword' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `req_plus_keyword'/m) do
assert_equal([{:a=>1}, {}], req_plus_keyword(:a=>1))
end
- assert_warn(/The keyword argument for `req_plus_keyword' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `req_plus_keyword'/m) do
assert_equal([{"a"=>1}, {}], req_plus_keyword("a"=>1))
end
- assert_warn(/The keyword argument for `req_plus_keyword' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `req_plus_keyword'/m) do
assert_equal([{"a"=>1, :a=>1}, {}], req_plus_keyword("a"=>1, :a=>1))
end
assert_equal([{:a=>1}, {}], req_plus_keyword({:a=>1}))
@@ -402,22 +402,22 @@ class TestKeywordArguments < Test::Unit::TestCase
assert_equal([1, {:a=>1}], opt_plus_keyword(:a=>1))
assert_equal([1, {"a"=>1}], opt_plus_keyword("a"=>1))
assert_equal([1, {"a"=>1, :a=>1}], opt_plus_keyword("a"=>1, :a=>1))
- assert_warn(/The last argument for `opt_plus_keyword' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `opt_plus_keyword'/m) do
assert_equal([1, {:a=>1}], opt_plus_keyword({:a=>1}))
end
assert_equal([{"a"=>1}, {}], opt_plus_keyword({"a"=>1}))
- assert_warn(/The last argument for `opt_plus_keyword' .* is split into positional and keyword parameters/) do
+ assert_warn(/The last argument is split into positional and keyword parameters.* for `opt_plus_keyword'/m) do
assert_equal([{"a"=>1}, {:a=>1}], opt_plus_keyword({"a"=>1, :a=>1}))
end
assert_equal([[], {:a=>1}], splat_plus_keyword(:a=>1))
assert_equal([[], {"a"=>1}], splat_plus_keyword("a"=>1))
assert_equal([[], {"a"=>1, :a=>1}], splat_plus_keyword("a"=>1, :a=>1))
- assert_warn(/The last argument for `splat_plus_keyword' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `splat_plus_keyword'/m) do
assert_equal([[], {:a=>1}], splat_plus_keyword({:a=>1}))
end
assert_equal([[{"a"=>1}], {}], splat_plus_keyword({"a"=>1}))
- assert_warn(/The last argument for `splat_plus_keyword' .* is split into positional and keyword parameters/) do
+ assert_warn(/The last argument is split into positional and keyword parameters.* for `splat_plus_keyword'/m) do
assert_equal([[{"a"=>1}], {:a=>1}], splat_plus_keyword({"a"=>1, :a=>1}))
end
end
@@ -604,7 +604,7 @@ class TestKeywordArguments < Test::Unit::TestCase
[a, b, c, d, e, f, g]
end
end
- assert_warn(/The keyword argument for `foo' .* is passed as the last hash parameter/) do
+ assert_warn(/The keyword argument is passed as the last hash parameter.* for `foo'/m) do
assert_equal([1, 2, 1, [], {:f=>5}, 2, {}], a.new.foo(1, 2, f:5), bug8993)
end
end
@@ -639,10 +639,10 @@ class TestKeywordArguments < Test::Unit::TestCase
o = Object.new
def o.to_hash() { k: 9 } end
assert_equal([1, 42, [], o, :key, {}, nil], f9(1, o))
- assert_warn(/The last argument for `m1' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `m1'/m) do
assert_equal([1, 9], m1(1, o) {|a, k: 0| break [a, k]}, bug10016)
end
- assert_warn(/The last argument for `m1' .* is used as the keyword parameter/) do
+ assert_warn(/The last argument is used as the keyword parameter.* for `m1'/m) do
assert_equal([1, 9], m1(1, o, &->(a, k: 0) {break [a, k]}), bug10016)
end
end
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index 85ff68ec25..b98a233937 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -155,7 +155,7 @@ class TestSyntax < Test::Unit::TestCase
h = {k3: 31}
assert_raise(ArgumentError) {o.kw(**h)}
h = {"k1"=>11, k2: 12}
- assert_warn(/The last argument for `kw' .* is split into positional and keyword parameters/) do
+ assert_warn(/The last argument is split into positional and keyword parameters.* for `kw'/m) do
assert_raise(ArgumentError) {o.kw(**h)}
end
end