@@ -84,6 +84,7 @@ def __init__(self):
8484 ('parser_definition' , d ('block' )),
8585 ('impl_definition' , d ('block' )),
8686 ))
87+ self .functions = []
8788
8889 def get_destination (self , name ):
8990 d = self .destinations .get (name )
@@ -104,6 +105,9 @@ def directive(self, name, args):
104105
105106 _module_and_class = clinic .Clinic ._module_and_class
106107
108+ def __repr__ (self ):
109+ return "<FakeClinic object>"
110+
107111
108112class ClinicWholeFileTest (_ParserBase ):
109113 def setUp (self ):
@@ -672,6 +676,19 @@ def test_c_name(self):
672676 """ )
673677 self .assertEqual ("os_stat_fn" , function .c_basename )
674678
679+ def test_cloning_nonexistent_function_correctly_fails (self ):
680+ stdout = self .parse_function_should_fail ("""
681+ cloned = fooooooooooooooooooooooo
682+ This is trying to clone a nonexistent function!!
683+ """ )
684+ expected_error = """\
685+ cls=None, module=<FakeClinic object>, existing='fooooooooooooooooooooooo'
686+ (cls or module).functions=[]
687+ Error on line 0:
688+ Couldn't find existing function 'fooooooooooooooooooooooo'!
689+ """
690+ self .assertEqual (expected_error , stdout )
691+
675692 def test_return_converter (self ):
676693 function = self .parse_function ("""
677694 module os
0 commit comments