mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Ignore warnings about ambiguous first argument of regexp with assert match.
This commit is contained in:
parent
f630359d9b
commit
9eecd7a2fd
4 changed files with 16 additions and 16 deletions
|
@ -27,15 +27,15 @@ class JSONCommonInterfaceTest < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_parser
|
def test_parser
|
||||||
assert_match /::Parser\z/, JSON.parser.name
|
assert_match(/::Parser\z/, JSON.parser.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_generator
|
def test_generator
|
||||||
assert_match /::Generator\z/, JSON.generator.name
|
assert_match(/::Generator\z/, JSON.generator.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_state
|
def test_state
|
||||||
assert_match /::Generator::State\z/, JSON.state.name
|
assert_match(/::Generator::State\z/, JSON.state.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_create_id
|
def test_create_id
|
||||||
|
|
|
@ -234,8 +234,8 @@ class TestObjSpace < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_dump_flags
|
def test_dump_flags
|
||||||
info = ObjectSpace.dump("foo".freeze)
|
info = ObjectSpace.dump("foo".freeze)
|
||||||
assert_match /"wb_protected":true, "old":true/, info
|
assert_match(/"wb_protected":true, "old":true/, info)
|
||||||
assert_match /"fstring":true/, info
|
assert_match(/"fstring":true/, info)
|
||||||
JSON.parse(info) if defined?(JSON)
|
JSON.parse(info) if defined?(JSON)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -267,10 +267,10 @@ class TestObjSpace < Test::Unit::TestCase
|
||||||
|
|
||||||
def assert_dump_object(info, line)
|
def assert_dump_object(info, line)
|
||||||
loc = caller_locations(1, 1)[0]
|
loc = caller_locations(1, 1)[0]
|
||||||
assert_match /"type":"STRING"/, info
|
assert_match(/"type":"STRING"/, info)
|
||||||
assert_match /"embedded":true, "bytesize":11, "value":"hello world", "encoding":"UTF-8"/, info
|
assert_match(/"embedded":true, "bytesize":11, "value":"hello world", "encoding":"UTF-8"/, info)
|
||||||
assert_match /"file":"#{Regexp.escape __FILE__}", "line":#{line}/, info
|
assert_match(/"file":"#{Regexp.escape __FILE__}", "line":#{line}/, info)
|
||||||
assert_match /"method":"#{loc.base_label}"/, info
|
assert_match(/"method":"#{loc.base_label}"/, info)
|
||||||
JSON.parse(info) if defined?(JSON)
|
JSON.parse(info) if defined?(JSON)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -285,8 +285,8 @@ class TestObjSpace < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_dump_dynamic_symbol
|
def test_dump_dynamic_symbol
|
||||||
dump = ObjectSpace.dump(("foobar%x" % rand(0x10000)).to_sym)
|
dump = ObjectSpace.dump(("foobar%x" % rand(0x10000)).to_sym)
|
||||||
assert_match /"type":"SYMBOL"/, dump
|
assert_match(/"type":"SYMBOL"/, dump)
|
||||||
assert_match /"value":"foobar\h+"/, dump
|
assert_match(/"value":"foobar\h+"/, dump)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_dump_includes_imemo_type
|
def test_dump_includes_imemo_type
|
||||||
|
@ -430,8 +430,8 @@ class TestObjSpace < Test::Unit::TestCase
|
||||||
puts ObjectSpace.dump(File.allocate)
|
puts ObjectSpace.dump(File.allocate)
|
||||||
RUBY
|
RUBY
|
||||||
assert_nil error
|
assert_nil error
|
||||||
assert_match /"type":"FILE"/, output
|
assert_match(/"type":"FILE"/, output)
|
||||||
assert_not_match /"fd":/, output
|
assert_not_match(/"fd":/, output)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -283,9 +283,9 @@ class TestISeq < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_inspect
|
def test_inspect
|
||||||
%W[foo \u{30d1 30b9}].each do |name|
|
%W[foo \u{30d1 30b9}].each do |name|
|
||||||
assert_match /@#{name}/, ISeq.compile("", name).inspect, name
|
assert_match(/@#{name}/, ISeq.compile("", name).inspect, name)
|
||||||
m = ISeq.compile("class TestISeq::Inspect; def #{name}; end; instance_method(:#{name}); end").eval
|
m = ISeq.compile("class TestISeq::Inspect; def #{name}; end; instance_method(:#{name}); end").eval
|
||||||
assert_match /:#{name}@/, ISeq.of(m).inspect, name
|
assert_match(/:#{name}@/, ISeq.of(m).inspect, name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ module WEBrick
|
||||||
io.rewind
|
io.rewind
|
||||||
res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
|
res = Net::HTTPResponse.read_new(Net::BufferedIO.new(io))
|
||||||
assert_equal '300', res.code
|
assert_equal '300', res.code
|
||||||
refute_match /<img/, io.string
|
refute_match(/<img/, io.string)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_304_does_not_log_warning
|
def test_304_does_not_log_warning
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue