зеркало из https://github.com/github/ruby.git
* test/ruby/test_m17n.rb (assert_warning): use common method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fbdce66908
Коммит
b30c4aa8d7
|
@ -1,5 +1,5 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'stringio'
|
require_relative 'envutil'
|
||||||
|
|
||||||
class TestM17N < Test::Unit::TestCase
|
class TestM17N < Test::Unit::TestCase
|
||||||
def assert_encoding(encname, actual, message=nil)
|
def assert_encoding(encname, actual, message=nil)
|
||||||
|
@ -23,17 +23,6 @@ class TestM17N < Test::Unit::TestCase
|
||||||
assert_equal(a(bytes), a(actual), message)
|
assert_equal(a(bytes), a(actual), message)
|
||||||
end
|
end
|
||||||
|
|
||||||
def assert_warning(pat, mesg=nil)
|
|
||||||
begin
|
|
||||||
org_stderr = $stderr
|
|
||||||
$stderr = StringIO.new(warn = '')
|
|
||||||
yield
|
|
||||||
ensure
|
|
||||||
$stderr = org_stderr
|
|
||||||
end
|
|
||||||
assert_match(pat, warn, mesg)
|
|
||||||
end
|
|
||||||
|
|
||||||
def assert_regexp_generic_encoding(r)
|
def assert_regexp_generic_encoding(r)
|
||||||
assert(!r.fixed_encoding?)
|
assert(!r.fixed_encoding?)
|
||||||
%w[ASCII-8BIT EUC-JP Windows-31J UTF-8].each {|ename|
|
%w[ASCII-8BIT EUC-JP Windows-31J UTF-8].each {|ename|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче