@@ -84,6 +84,7 @@ def __init__(self):
84
84
('parser_definition' , d ('block' )),
85
85
('impl_definition' , d ('block' )),
86
86
))
87
+ self .functions = []
87
88
88
89
def get_destination (self , name ):
89
90
d = self .destinations .get (name )
@@ -104,6 +105,9 @@ def directive(self, name, args):
104
105
105
106
_module_and_class = clinic .Clinic ._module_and_class
106
107
108
+ def __repr__ (self ):
109
+ return "<FakeClinic object>"
110
+
107
111
108
112
class ClinicWholeFileTest (_ParserBase ):
109
113
def setUp (self ):
@@ -672,6 +676,19 @@ def test_c_name(self):
672
676
""" )
673
677
self .assertEqual ("os_stat_fn" , function .c_basename )
674
678
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
+
675
692
def test_return_converter (self ):
676
693
function = self .parse_function ("""
677
694
module os
0 commit comments