2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2015-05-17 10:47:36 -04:00
|
|
|
require '-test-/notimplement'
|
2010-08-07 00:33:33 -04:00
|
|
|
|
2018-03-13 02:29:02 -04:00
|
|
|
class Test_NotImplement < Test::Unit::TestCase
|
2010-08-07 00:33:33 -04:00
|
|
|
def test_funcall_notimplement
|
|
|
|
bug3662 = '[ruby-dev:41953]'
|
|
|
|
assert_raise(NotImplementedError, bug3662) {
|
|
|
|
Bug.funcall(:notimplement)
|
|
|
|
}
|
2018-08-21 10:57:56 -04:00
|
|
|
assert_raise(NotImplementedError) {
|
|
|
|
Bug::NotImplement.new.notimplement
|
|
|
|
}
|
2010-08-07 00:33:33 -04:00
|
|
|
end
|
2015-05-18 02:31:42 -04:00
|
|
|
|
|
|
|
def test_respond_to
|
2020-02-28 07:15:37 -05:00
|
|
|
assert_include(Bug.methods(false), :notimplement)
|
|
|
|
assert_include(Bug::NotImplement.instance_methods(false), :notimplement)
|
2015-05-18 02:31:42 -04:00
|
|
|
assert_not_respond_to(Bug, :notimplement)
|
2018-08-21 10:57:56 -04:00
|
|
|
assert_not_respond_to(Bug::NotImplement.new, :notimplement)
|
2015-05-18 02:31:42 -04:00
|
|
|
end
|
2018-08-13 09:27:49 -04:00
|
|
|
|
2020-02-28 07:15:37 -05:00
|
|
|
def test_method_inspect_notimplement
|
|
|
|
assert_match(/not-implemented/, Bug.method(:notimplement).inspect)
|
|
|
|
assert_match(/not-implemented/, Bug::NotImplement.instance_method(:notimplement).inspect)
|
|
|
|
end
|
|
|
|
|
2018-08-13 09:27:49 -04:00
|
|
|
def test_not_method_defined
|
2018-08-13 09:50:48 -04:00
|
|
|
assert !Bug::NotImplement.method_defined?(:notimplement)
|
2018-08-13 10:29:21 -04:00
|
|
|
assert !Bug::NotImplement.method_defined?(:notimplement, true)
|
|
|
|
assert !Bug::NotImplement.method_defined?(:notimplement, false)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_not_private_method_defined
|
|
|
|
assert !Bug::NotImplement.private_method_defined?(:notimplement)
|
|
|
|
assert !Bug::NotImplement.private_method_defined?(:notimplement, true)
|
|
|
|
assert !Bug::NotImplement.private_method_defined?(:notimplement, false)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_not_protected_method_defined
|
|
|
|
assert !Bug::NotImplement.protected_method_defined?(:notimplement)
|
|
|
|
assert !Bug::NotImplement.protected_method_defined?(:notimplement, true)
|
|
|
|
assert !Bug::NotImplement.protected_method_defined?(:notimplement, false)
|
2018-08-13 09:27:49 -04:00
|
|
|
end
|
2010-08-07 00:33:33 -04:00
|
|
|
end
|