* 2022-01-18 [ci skip]
[ruby-80x24.org.git] / test / -ext- / test_notimplement.rb
blob038b507b73125844924ab3a2b5829cd115e9f9be
1 # frozen_string_literal: false
2 require '-test-/notimplement'
4 class Test_NotImplement < Test::Unit::TestCase
5   def test_funcall_notimplement
6     bug3662 = '[ruby-dev:41953]'
7     assert_raise(NotImplementedError, bug3662) {
8       Bug.funcall(:notimplement)
9     }
10     assert_raise(NotImplementedError) {
11       Bug::NotImplement.new.notimplement
12     }
13   end
15   def test_respond_to
16     assert_include(Bug.methods(false), :notimplement)
17     assert_include(Bug::NotImplement.instance_methods(false), :notimplement)
18     assert_not_respond_to(Bug, :notimplement)
19     assert_not_respond_to(Bug::NotImplement.new, :notimplement)
20   end
22   def test_method_inspect_notimplement
23     assert_match(/not-implemented/, Bug.method(:notimplement).inspect)
24     assert_match(/not-implemented/, Bug::NotImplement.instance_method(:notimplement).inspect)
25   end
27   def test_not_method_defined
28     assert !Bug::NotImplement.method_defined?(:notimplement)
29     assert !Bug::NotImplement.method_defined?(:notimplement, true)
30     assert !Bug::NotImplement.method_defined?(:notimplement, false)
31   end
33   def test_not_private_method_defined
34     assert !Bug::NotImplement.private_method_defined?(:notimplement)
35     assert !Bug::NotImplement.private_method_defined?(:notimplement, true)
36     assert !Bug::NotImplement.private_method_defined?(:notimplement, false)
37   end
39   def test_not_protected_method_defined
40     assert !Bug::NotImplement.protected_method_defined?(:notimplement)
41     assert !Bug::NotImplement.protected_method_defined?(:notimplement, true)
42     assert !Bug::NotImplement.protected_method_defined?(:notimplement, false)
43   end
44 end