Skip to content

Commit a1a21b5

Browse files
committed
Test the entire public API of hierarchies
1 parent cb36ff1 commit a1a21b5

File tree

4 files changed

+134
-76
lines changed

4 files changed

+134
-76
lines changed

ycmd/tests/clangd/subcommands_test.py

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,22 +1329,31 @@ def test_Subcommands_SupertypeHierarchy( self, app ):
13291329
for location, response, code in [
13301330
[ ( filepath, 16, 8 ),
13311331
contains_inanyorder(
1332-
has_entry( 'locations',
1333-
contains_exactly(
1334-
LocationMatcher( filepath, 13, 8 )
1335-
) ),
1336-
has_entry( 'locations',
1337-
contains_exactly(
1338-
LocationMatcher( filepath, 12, 8 )
1339-
) ),
1332+
has_entries( {
1333+
'locations': contains_exactly(
1334+
LocationMatcher( filepath, 13, 8 )
1335+
),
1336+
'name': 'B1',
1337+
'kind': 'Struct'
1338+
} ),
1339+
has_entries( {
1340+
'locations': contains_exactly(
1341+
LocationMatcher( filepath, 12, 8 )
1342+
),
1343+
'name': 'B0',
1344+
'kind': 'Struct'
1345+
} ),
13401346
),
13411347
requests.codes.ok ],
13421348
[ ( filepath, 13, 8 ),
13431349
contains_inanyorder(
1344-
has_entry( 'locations',
1345-
contains_exactly(
1346-
LocationMatcher( filepath, 12, 8 )
1347-
) ),
1350+
has_entries( {
1351+
'locations': contains_exactly(
1352+
LocationMatcher( filepath, 12, 8 )
1353+
),
1354+
'name': 'B0',
1355+
'kind': 'Struct'
1356+
} ),
13481357
),
13491358
requests.codes.ok ],
13501359
[ ( filepath, 12, 8 ),
@@ -1361,18 +1370,28 @@ def test_Subcommands_SubtypeHierarchy( self, app ):
13611370
for location, response, code in [
13621371
[ ( filepath, 12, 8 ),
13631372
contains_inanyorder(
1364-
has_entry( 'locations',
1365-
contains_exactly(
1366-
LocationMatcher( filepath, 13, 8 )
1367-
) ),
1368-
has_entry( 'locations',
1369-
contains_exactly(
1370-
LocationMatcher( filepath, 15, 8 )
1371-
) ),
1372-
has_entry( 'locations',
1373-
contains_exactly(
1374-
LocationMatcher( filepath, 16, 8 )
1375-
) ) ),
1373+
has_entries( {
1374+
'locations': contains_exactly(
1375+
LocationMatcher( filepath, 13, 8 )
1376+
),
1377+
'name': 'B1',
1378+
'kind': 'Struct'
1379+
} ),
1380+
has_entries( {
1381+
'locations': contains_exactly(
1382+
LocationMatcher( filepath, 15, 8 )
1383+
),
1384+
'name': 'D0',
1385+
'kind': 'Struct'
1386+
} ),
1387+
has_entries( {
1388+
'locations': contains_exactly(
1389+
LocationMatcher( filepath, 16, 8 )
1390+
),
1391+
'name': 'D1',
1392+
'kind': 'Struct'
1393+
} ),
1394+
),
13761395
requests.codes.ok ],
13771396
[ ( filepath, 13, 8 ),
13781397
contains_inanyorder(
@@ -1399,19 +1418,25 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
13991418
'locations': contains_exactly(
14001419
LocationMatcher( filepath, 4, 12 ),
14011420
LocationMatcher( filepath, 4, 18 ) ),
1402-
'root_location': LocationMatcher( filepath, 3, 5 )
1421+
'root_location': LocationMatcher( filepath, 3, 5 ),
1422+
'name': 'g',
1423+
'kind': 'Function'
14031424
} ),
14041425
has_entries( {
14051426
'locations': contains_exactly( LocationMatcher( filepath, 9, 12 ) ),
1406-
'root_location': LocationMatcher( filepath, 7, 5 )
1427+
'root_location': LocationMatcher( filepath, 7, 5 ),
1428+
'name': 'h',
1429+
'kind': 'Function'
14071430
} )
14081431
),
14091432
requests.codes.ok ],
14101433
[ ( filepath, 3, 5 ),
14111434
contains_inanyorder(
14121435
has_entries( {
14131436
'locations': contains_exactly( LocationMatcher( filepath, 8, 13 ) ),
1414-
'root_location': LocationMatcher( filepath, 7, 5 )
1437+
'root_location': LocationMatcher( filepath, 7, 5 ),
1438+
'name': 'h',
1439+
'kind': 'Function'
14151440
} )
14161441
),
14171442
requests.codes.ok ],

ycmd/tests/go/subcommands_test.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -567,22 +567,30 @@ def test_Subcommands_OutgoingCallHierarchy( self, app ):
567567
for location, response, code in [
568568
[ ( filepath, 9, 6 ),
569569
contains_inanyorder(
570-
has_entry( 'locations',
571-
contains_exactly(
572-
LocationMatcher( filepath, 10, 13 ),
573-
) ),
574-
has_entry( 'locations',
575-
contains_exactly(
576-
LocationMatcher( filepath, 11, 12 )
577-
) ) ),
570+
has_entries( {
571+
'locations': contains_exactly(
572+
LocationMatcher( filepath, 10, 13 ) ),
573+
'kind': 'Function',
574+
'name': 'g'
575+
} ),
576+
has_entries( {
577+
'locations': contains_exactly(
578+
LocationMatcher( filepath, 11, 12 ) ),
579+
'kind': 'Function',
580+
'name': 'f'
581+
} )
582+
),
578583
requests.codes.ok ],
579584
[ ( filepath, 6, 6 ),
580585
contains_inanyorder(
581-
has_entry( 'locations',
582-
contains_exactly(
583-
LocationMatcher( filepath, 7, 12 ),
584-
LocationMatcher( filepath, 7, 18 )
585-
) ) ),
586+
has_entries( {
587+
'locations': contains_exactly(
588+
LocationMatcher( filepath, 7, 12 ),
589+
LocationMatcher( filepath, 7, 18 ) ),
590+
'kind': 'Function',
591+
'name': 'f'
592+
} ),
593+
),
586594
requests.codes.ok ],
587595
[ ( filepath, 3, 6 ),
588596
ErrorMatcher( RuntimeError, 'No outgoing calls found.' ),
@@ -602,12 +610,16 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
602610
'locations': contains_exactly(
603611
LocationMatcher( filepath, 7, 12 ),
604612
LocationMatcher( filepath, 7, 18 ) ),
605-
'root_location': LocationMatcher( filepath, 6, 6 )
613+
'root_location': LocationMatcher( filepath, 6, 6 ),
614+
'name': 'g',
615+
'kind': 'Function'
606616
} ),
607617
has_entries( {
608618
'locations': contains_exactly(
609619
LocationMatcher( filepath, 11, 12 ) ),
610-
'root_location': LocationMatcher( filepath, 9, 6 )
620+
'root_location': LocationMatcher( filepath, 9, 6 ),
621+
'name': 'h',
622+
'kind': 'Function'
611623
} )
612624
),
613625
requests.codes.ok ],
@@ -616,7 +628,9 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
616628
has_entries( {
617629
'locations': contains_exactly(
618630
LocationMatcher( filepath, 10, 13 ) ),
619-
'root_location': LocationMatcher( filepath, 9, 6 )
631+
'root_location': LocationMatcher( filepath, 9, 6 ),
632+
'name': 'h',
633+
'kind': 'Function'
620634
} )
621635
),
622636
requests.codes.ok ],

ycmd/tests/rust/subcommands_test.py

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -598,14 +598,19 @@ def test_Subcommands_OutgoingCallHierarchy( self, app ):
598598
for location, response, code in [
599599
[ ( filepath, 9, 4 ),
600600
contains_inanyorder(
601-
has_entry( 'locations',
602-
contains_exactly(
603-
LocationMatcher( filepath, 10, 13 ),
604-
) ),
605-
has_entry( 'locations',
606-
contains_exactly(
607-
LocationMatcher( filepath, 11, 5 )
608-
) ) ),
601+
has_entries( {
602+
'locations': contains_exactly(
603+
LocationMatcher( filepath, 10, 13 ) ),
604+
'kind': 'Function',
605+
'name': 'g'
606+
} ),
607+
has_entries( {
608+
'locations': contains_exactly(
609+
LocationMatcher( filepath, 11, 5 ) ),
610+
'kind': 'Function',
611+
'name': 'f'
612+
} )
613+
),
609614
requests.codes.ok ],
610615
[ ( filepath, 5, 4 ),
611616
contains_inanyorder(
@@ -633,16 +638,16 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
633638
'locations': contains_exactly(
634639
LocationMatcher( filepath, 6, 5 ),
635640
LocationMatcher( filepath, 6, 11 ) ),
636-
# rust-analyzer always returns column 1 for root_location,
637-
# which is useless for us... unfortunately.
638-
'root_location': LocationMatcher( filepath, 5, 4 )
641+
'root_location': LocationMatcher( filepath, 5, 4 ),
642+
'name': 'g',
643+
'kind': 'Function'
639644
} ),
640645
has_entries( {
641646
'locations': contains_exactly(
642647
LocationMatcher( filepath, 11, 5 ) ),
643-
# rust-analyzer always returns column 1 for root_location,
644-
# which is useless for us... unfortunately.
645-
'root_location': LocationMatcher( filepath, 9, 4 )
648+
'root_location': LocationMatcher( filepath, 9, 4 ),
649+
'name': 'h',
650+
'kind': 'Function'
646651
} )
647652
),
648653
requests.codes.ok ],
@@ -651,9 +656,9 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
651656
has_entries( {
652657
'locations': contains_exactly(
653658
LocationMatcher( filepath, 10, 13 ) ),
654-
# rust-analyzer always returns column 1 for root_location,
655-
# which is useless for us... unfortunately.
656-
'root_location': LocationMatcher( filepath, 9, 4 )
659+
'root_location': LocationMatcher( filepath, 9, 4 ),
660+
'name': 'h',
661+
'kind': 'Function'
657662
} )
658663
),
659664
requests.codes.ok ],

ycmd/tests/typescript/subcommands_test.py

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,22 +1205,30 @@ def test_Subcommands_OutgoingCallHierarchy( self, app ):
12051205
for location, response, code in [
12061206
[ ( filepath, 9, 10 ),
12071207
contains_inanyorder(
1208-
has_entry( 'locations',
1209-
contains_exactly(
1210-
LocationMatcher( filepath, 10, 11 ),
1211-
) ),
1212-
has_entry( 'locations',
1213-
contains_exactly(
1214-
LocationMatcher( filepath, 11, 14 )
1215-
) ) ),
1208+
has_entries( {
1209+
'locations': contains_exactly(
1210+
LocationMatcher( filepath, 10, 11 ) ),
1211+
'kind': 'function',
1212+
'name': 'g'
1213+
} ),
1214+
has_entries( {
1215+
'locations': contains_exactly(
1216+
LocationMatcher( filepath, 11, 14 ) ),
1217+
'kind': 'function',
1218+
'name': 'f'
1219+
} )
1220+
),
12161221
requests.codes.ok ],
12171222
[ ( filepath, 5, 10 ),
12181223
contains_inanyorder(
1219-
has_entry( 'locations',
1220-
contains_exactly(
1221-
LocationMatcher( filepath, 6, 10 ),
1222-
LocationMatcher( filepath, 6, 16 )
1223-
) ) ),
1224+
has_entries( {
1225+
'locations': contains_exactly(
1226+
LocationMatcher( filepath, 6, 10 ),
1227+
LocationMatcher( filepath, 6, 16 ) ),
1228+
'kind': 'function',
1229+
'name': 'f'
1230+
} ),
1231+
),
12241232
requests.codes.ok ],
12251233
[ ( filepath, 1, 10 ),
12261234
ErrorMatcher( RuntimeError, 'No outgoing calls found.' ),
@@ -1240,12 +1248,16 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
12401248
'locations': contains_exactly(
12411249
LocationMatcher( filepath, 6, 10 ),
12421250
LocationMatcher( filepath, 6, 16 ) ),
1243-
'root_location': LocationMatcher( filepath, 5, 10 )
1251+
'root_location': LocationMatcher( filepath, 5, 10 ),
1252+
'name': 'g',
1253+
'kind': 'function'
12441254
} ),
12451255
has_entries( {
12461256
'locations': contains_exactly(
12471257
LocationMatcher( filepath, 11, 14 ) ),
1248-
'root_location': LocationMatcher( filepath, 9, 10 )
1258+
'root_location': LocationMatcher( filepath, 9, 10 ),
1259+
'name': 'h',
1260+
'kind': 'function'
12491261
} )
12501262
),
12511263
requests.codes.ok ],
@@ -1254,7 +1266,9 @@ def test_Subcommands_IncomingCallHierarchy( self, app ):
12541266
has_entries( {
12551267
'locations': contains_exactly(
12561268
LocationMatcher( filepath, 10, 11 ) ),
1257-
'root_location': LocationMatcher( filepath, 9, 10 )
1269+
'root_location': LocationMatcher( filepath, 9, 10 ),
1270+
'name': 'h',
1271+
'kind': 'function'
12581272
} )
12591273
),
12601274
requests.codes.ok ],

0 commit comments

Comments
 (0)