Use Test::Unit::TestCase instead of MiniTest::Unit::TestCase. Because

tests of fiddle already used customized assertions of ruby core.

  * test/fiddle/helper.rb: Use Test::Unit::TestCase for base class of
    testcase.
  * test/fiddle/test_*.rb: Use assert_raise instead of assert_raises.
    Remove needless includes for Test::Unit::Assertions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2017-07-13 09:46:16 +00:00
Родитель 52e8254b54
Коммит 24873d1a05
8 изменённых файлов: 9 добавлений и 15 удалений

Просмотреть файл

@ -1,5 +1,5 @@
# frozen_string_literal: false
require 'minitest/autorun'
require 'test/unit'
require 'fiddle'
# FIXME: this is stolen from DL and needs to be refactored.
@ -108,7 +108,7 @@ Fiddle::LIBC_SO = libc_so
Fiddle::LIBM_SO = libm_so
module Fiddle
class TestCase < MiniTest::Unit::TestCase
class TestCase < Test::Unit::TestCase
def setup
@libc = Fiddle.dlopen(LIBC_SO)
@libm = Fiddle.dlopen(LIBM_SO)

Просмотреть файл

@ -7,15 +7,15 @@ end
module Fiddle
class TestClosure < Fiddle::TestCase
def test_argument_errors
assert_raises(TypeError) do
assert_raise(TypeError) do
Closure.new(TYPE_INT, TYPE_INT)
end
assert_raises(TypeError) do
assert_raise(TypeError) do
Closure.new('foo', [TYPE_INT])
end
assert_raises(TypeError) do
assert_raise(TypeError) do
Closure.new(TYPE_INT, ['meow!'])
end
end

Просмотреть файл

@ -61,7 +61,7 @@ module Fiddle
end
def test_undefined_ctype
assert_raises(DLError) { parse_ctype('DWORD') }
assert_raise(DLError) { parse_ctype('DWORD') }
end
def test_undefined_ctype_with_type_alias
@ -93,7 +93,7 @@ module Fiddle
end
def test_struct_undefined
assert_raises(DLError) { parse_struct_signature(['int i', 'DWORD cb']) }
assert_raise(DLError) { parse_struct_signature(['int i', 'DWORD cb']) }
end
def test_struct_undefined_with_type_alias

Просмотреть файл

@ -13,7 +13,7 @@ module Fiddle
def test_syscall_with_tainted_string
f = Function.new(@libc['system'], [TYPE_VOIDP], TYPE_INT)
assert_raises(SecurityError) do
assert_raise(SecurityError) do
Thread.new {
$SAFE = 1
f.call("uname -rs".taint)

Просмотреть файл

@ -6,8 +6,6 @@ end
module Fiddle
class TestFunction < Fiddle::TestCase
include Test::Unit::Assertions
def setup
super
Fiddle.last_error = nil

Просмотреть файл

@ -8,8 +8,6 @@ module Fiddle
class TestHandle < TestCase
include Fiddle
include Test::Unit::Assertions
def test_safe_handle_open
t = Thread.new do
$SAFE = 1

Просмотреть файл

@ -45,7 +45,7 @@ module Fiddle
class TestImport < TestCase
def test_ensure_call_dlload
err = assert_raises(RuntimeError) do
err = assert_raise(RuntimeError) do
Class.new do
extend Importer
extern "void *strcpy(char*, char*)"

Просмотреть файл

@ -10,8 +10,6 @@ module Fiddle
Fiddle.dlwrap arg
end
include Test::Unit::Assertions
def test_cptr_to_int
null = Fiddle::NULL
assert_equal(null.to_i, null.to_int)