test/unit の assert_no_match について質問です。
assertions.rb で定義されている assert_match では、
第一引数が文字列であることが許されてますが、
assert_no_match では、第一引数は必ず Regexp でなければ、テスト失敗となり
ます。
assert_match が文字列指定が許されてるので、assert_no_match も文字列を指
定しても可、としたほうが一貫性があってよいと思うのですが、どうでしょうか。
-- code
require "test/unit"
class XTest < Test::Unit::TestCase
def test_assert_match
assert_match("x", "xyz")
assert_no_match("a", "xyz")
end
end
-- Result:
1) Failure:
test_assert_match(XTest) [x.rb:7]:
The first argument to assert_no_match should be a Regexp.
<"a"> expected to be an instance of
<Regexp> but was
<String>.
# ついでにいうと、引数の型が合ってないことを示すときは、TypeError を例外
# として投げたほうがいいのでは