File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -653,6 +653,37 @@ def test_no_c_basename_cloned(self):
653653 err = "No C basename provided after 'as' keyword"
654654 self .expect_failure (block , err , lineno = 5 )
655655
656+ def test_cloned_with_custom_c_basename (self ):
657+ raw = dedent ("""
658+ /*[clinic input]
659+ # Make sure we don't create spurious clinic/ directories.
660+ output everything suppress
661+ foo2
662+ [clinic start generated code]*/
663+
664+ /*[clinic input]
665+ foo as foo1 = foo2
666+ [clinic start generated code]*/
667+ """ )
668+ self .clinic .parse (raw )
669+ funcs = self .clinic .functions
670+ self .assertEqual (len (funcs ), 2 )
671+ self .assertEqual (funcs [1 ].name , "foo" )
672+ self .assertEqual (funcs [1 ].c_basename , "foo1" )
673+
674+ def test_cloned_with_illegal_c_basename (self ):
675+ block = """
676+ /*[clinic input]
677+ class C "void *" ""
678+ foo1
679+ [clinic start generated code]*/
680+
681+ /*[clinic input]
682+ foo2 as .illegal. = foo1
683+ [clinic start generated code]*/
684+ """
685+ err = "Illegal C basename: '.illegal. = foo1'"
686+ self .expect_failure (block , err , lineno = 7 )
656687
657688
658689class ParseFileUnitTest (TestCase ):
You can’t perform that action at this time.
0 commit comments