@@ -673,6 +673,40 @@ def test_ids_vs_tags2(app, warning):
673673 assert len (ws ) == 0
674674
675675
676+ @pytest .mark .sphinx (testroot = 'domain-c' , confoverrides = {'nitpicky' : True })
677+ def test_ids_vs_tags3 (app , warning ):
678+ app .builder .build_all ()
679+ ws = filter_warnings (warning , "ids-vs-tags3" )
680+ assert len (ws ) == 0
681+ t = (app .outdir / "ids-vs-tags3.html" ).read_text ()
682+ lis = [l for l in t .split ('\n ' ) if l .startswith ("<li" )]
683+ entries = []
684+ for l in lis :
685+ li = ElementTree .fromstring (l )
686+ assert li .tag == 'li'
687+ assert len (li ) == 1
688+ p = li [0 ]
689+ assert p .tag == 'p'
690+ assert len (p ) == 1
691+ a = p [0 ]
692+ assert a .tag == 'a'
693+ target = a .attrib ['href' ].lstrip ('#' )
694+ title = a .attrib ['title' ]
695+ assert len (a ) == 1
696+ code = a [0 ]
697+ assert code .tag == 'code'
698+ text = '' .join (code .itertext ())
699+ entries .append ((target , title , text ))
700+ idPrefix = 'C2-@ids_vs_tags3.'
701+ expected = [
702+ (idPrefix + 'f1' , 'f1.i' , 'f1.i' ),
703+ (idPrefix + '-f1.i' , 'struct f1.i' , 'struct f1.i' ),
704+ (idPrefix + 'f2' , 'f2.i' , 'f2.i' ),
705+ (idPrefix + '-f2.i' , 'struct f2.i' , 'struct f2.i' ),
706+ ]
707+ assert entries == expected
708+
709+
676710def test_duplicate_tags (app , warning ):
677711 text = """
678712.. c:struct:: A
0 commit comments