rubydex 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,7 @@
1
- use super::Resolver;
1
+ // This file is included via #[path] by both resolution.rs and operation/applier.rs
2
+ // to run the same tests against both indexing backends. Each parent module provides
3
+ // a `backend()` function that `graph_test()` calls via `super::backend()`.
4
+
2
5
  use crate::{
3
6
  assert_alias_targets_contain, assert_ancestors_eq, assert_constant_alias_target_eq, assert_constant_reference_to,
4
7
  assert_constant_reference_unresolved, assert_declaration_definitions_count_eq, assert_declaration_does_not_exist,
@@ -7,15 +10,20 @@ use crate::{
7
10
  assert_no_diagnostics, assert_no_members, assert_owner_eq, assert_singleton_class_eq,
8
11
  diagnostic::Rule,
9
12
  model::{declaration::Ancestors, ids::DeclarationId, name::NameRef},
13
+ resolution::Resolver,
10
14
  test_utils::GraphTest,
11
15
  };
12
16
 
17
+ fn graph_test() -> GraphTest {
18
+ GraphTest::new_with_backend(super::backend())
19
+ }
20
+
13
21
  mod constant_resolution_tests {
14
22
  use super::*;
15
23
 
16
24
  #[test]
17
25
  fn resolving_top_level_references() {
18
- let mut context = GraphTest::new();
26
+ let mut context = graph_test();
19
27
  context.index_uri("file:///bar.rb", {
20
28
  r"
21
29
  class Bar; end
@@ -42,7 +50,7 @@ mod constant_resolution_tests {
42
50
 
43
51
  #[test]
44
52
  fn resolving_nested_reference() {
45
- let mut context = GraphTest::new();
53
+ let mut context = graph_test();
46
54
  context.index_uri("file:///bar.rb", {
47
55
  r"
48
56
  module Foo
@@ -63,7 +71,7 @@ mod constant_resolution_tests {
63
71
 
64
72
  #[test]
65
73
  fn resolving_nested_reference_that_refer_to_top_level_constant() {
66
- let mut context = GraphTest::new();
74
+ let mut context = graph_test();
67
75
  context.index_uri("file:///bar.rb", {
68
76
  r"
69
77
  class Baz; end
@@ -84,7 +92,7 @@ mod constant_resolution_tests {
84
92
 
85
93
  #[test]
86
94
  fn resolving_constant_path_references_at_top_level() {
87
- let mut context = GraphTest::new();
95
+ let mut context = graph_test();
88
96
  context.index_uri("file:///bar.rb", {
89
97
  r"
90
98
  module Foo
@@ -103,7 +111,7 @@ mod constant_resolution_tests {
103
111
 
104
112
  #[test]
105
113
  fn resolving_reference_for_non_existing_declaration() {
106
- let mut context = GraphTest::new();
114
+ let mut context = graph_test();
107
115
  context.index_uri("file:///foo.rb", {
108
116
  r"
109
117
  Foo
@@ -117,7 +125,7 @@ mod constant_resolution_tests {
117
125
 
118
126
  #[test]
119
127
  fn resolution_for_top_level_references() {
120
- let mut context = GraphTest::new();
128
+ let mut context = graph_test();
121
129
  context.index_uri("file:///foo.rb", {
122
130
  r"
123
131
  module Foo
@@ -148,7 +156,7 @@ mod constant_alias_tests {
148
156
 
149
157
  #[test]
150
158
  fn resolving_constant_alias_to_module() {
151
- let mut context = GraphTest::new();
159
+ let mut context = graph_test();
152
160
  context.index_uri("file:///foo.rb", {
153
161
  r"
154
162
  module Foo
@@ -168,7 +176,7 @@ mod constant_alias_tests {
168
176
 
169
177
  #[test]
170
178
  fn resolving_constant_alias_to_nested_module() {
171
- let mut context = GraphTest::new();
179
+ let mut context = graph_test();
172
180
  context.index_uri("file:///foo.rb", {
173
181
  r"
174
182
  module Foo
@@ -190,7 +198,7 @@ mod constant_alias_tests {
190
198
 
191
199
  #[test]
192
200
  fn resolving_constant_alias_inside_module() {
193
- let mut context = GraphTest::new();
201
+ let mut context = graph_test();
194
202
  context.index_uri("file:///foo.rb", {
195
203
  r"
196
204
  module Foo
@@ -213,7 +221,7 @@ mod constant_alias_tests {
213
221
 
214
222
  #[test]
215
223
  fn resolving_constant_alias_in_superclass() {
216
- let mut context = GraphTest::new();
224
+ let mut context = graph_test();
217
225
  context.index_uri("file:///foo.rb", {
218
226
  r"
219
227
  class Foo
@@ -236,7 +244,7 @@ mod constant_alias_tests {
236
244
 
237
245
  #[test]
238
246
  fn resolving_chained_constant_aliases() {
239
- let mut context = GraphTest::new();
247
+ let mut context = graph_test();
240
248
  context.index_uri("file:///foo.rb", {
241
249
  r"
242
250
  module Foo
@@ -259,7 +267,7 @@ mod constant_alias_tests {
259
267
 
260
268
  #[test]
261
269
  fn resolving_constant_alias_to_non_existent_target() {
262
- let mut context = GraphTest::new();
270
+ let mut context = graph_test();
263
271
  context.index_uri("file:///foo.rb", {
264
272
  r"
265
273
  ALIAS_1 = NonExistent
@@ -276,7 +284,7 @@ mod constant_alias_tests {
276
284
 
277
285
  #[test]
278
286
  fn resolving_constant_alias_to_value_in_constant_path() {
279
- let mut context = GraphTest::new();
287
+ let mut context = graph_test();
280
288
  context.index_uri("file:///foo.rb", {
281
289
  r"
282
290
  VALUE = 1
@@ -296,7 +304,7 @@ mod constant_alias_tests {
296
304
 
297
305
  #[test]
298
306
  fn resolving_constant_alias_defined_before_target() {
299
- let mut context = GraphTest::new();
307
+ let mut context = graph_test();
300
308
  context.index_uri("file:///foo.rb", {
301
309
  r"
302
310
  ALIAS = Foo
@@ -316,7 +324,7 @@ mod constant_alias_tests {
316
324
 
317
325
  #[test]
318
326
  fn resolving_constant_alias_to_value() {
319
- let mut context = GraphTest::new();
327
+ let mut context = graph_test();
320
328
  context.index_uri("file:///foo.rb", {
321
329
  r"
322
330
  class Foo
@@ -338,7 +346,7 @@ mod constant_alias_tests {
338
346
 
339
347
  #[test]
340
348
  fn resolving_circular_constant_aliases() {
341
- let mut context = GraphTest::new();
349
+ let mut context = graph_test();
342
350
  context.index_uri("file:///foo.rb", {
343
351
  r"
344
352
  A = B
@@ -357,7 +365,7 @@ mod constant_alias_tests {
357
365
 
358
366
  #[test]
359
367
  fn resolving_circular_constant_aliases_cross_namespace() {
360
- let mut context = GraphTest::new();
368
+ let mut context = graph_test();
361
369
  context.index_uri("file:///foo.rb", {
362
370
  r"
363
371
  module A
@@ -383,7 +391,7 @@ mod constant_alias_tests {
383
391
 
384
392
  #[test]
385
393
  fn resolving_constant_alias_ping_pong() {
386
- let mut context = GraphTest::new();
394
+ let mut context = graph_test();
387
395
  context.index_uri("file:///foo.rb", {
388
396
  r"
389
397
  module Left
@@ -422,7 +430,7 @@ mod constant_alias_tests {
422
430
 
423
431
  #[test]
424
432
  fn resolving_constant_alias_self_referential() {
425
- let mut context = GraphTest::new();
433
+ let mut context = graph_test();
426
434
  context.index_uri("file:///foo.rb", {
427
435
  r"
428
436
  module M
@@ -461,7 +469,7 @@ mod constant_alias_tests {
461
469
 
462
470
  #[test]
463
471
  fn resolving_constant_alias_with_multiple_definitions() {
464
- let mut context = GraphTest::new();
472
+ let mut context = graph_test();
465
473
  context.index_uri("file:///a.rb", {
466
474
  r"
467
475
  module A; end
@@ -486,7 +494,7 @@ mod constant_alias_tests {
486
494
 
487
495
  #[test]
488
496
  fn resolving_constant_alias_with_multiple_targets() {
489
- let mut context = GraphTest::new();
497
+ let mut context = graph_test();
490
498
  context.index_uri("file:///a.rb", {
491
499
  r"
492
500
  module A
@@ -519,7 +527,7 @@ mod constant_alias_tests {
519
527
 
520
528
  #[test]
521
529
  fn resolving_constant_alias_multi_target_with_circular() {
522
- let mut context = GraphTest::new();
530
+ let mut context = graph_test();
523
531
  context.index_uri("file:///a.rb", {
524
532
  r"
525
533
  module A
@@ -543,7 +551,7 @@ mod constant_alias_tests {
543
551
 
544
552
  #[test]
545
553
  fn multi_target_alias_constant_added_to_primary_owner() {
546
- let mut context = GraphTest::new();
554
+ let mut context = graph_test();
547
555
  context.index_uri("file:///modules.rb", {
548
556
  r"
549
557
  module Foo; end
@@ -575,7 +583,7 @@ mod constant_alias_tests {
575
583
 
576
584
  #[test]
577
585
  fn resolving_class_through_constant_alias() {
578
- let mut context = GraphTest::new();
586
+ let mut context = graph_test();
579
587
  context.index_uri("file:///foo.rb", {
580
588
  r"
581
589
  module Outer
@@ -608,7 +616,7 @@ mod constant_alias_tests {
608
616
 
609
617
  #[test]
610
618
  fn resolving_class_definition_through_constant_alias() {
611
- let mut context = GraphTest::new();
619
+ let mut context = graph_test();
612
620
  context.index_uri("file:///foo.rb", {
613
621
  r"
614
622
  module Outer
@@ -645,7 +653,7 @@ mod constant_alias_tests {
645
653
 
646
654
  #[test]
647
655
  fn resolving_constant_reference_through_chained_aliases() {
648
- let mut context = GraphTest::new();
656
+ let mut context = graph_test();
649
657
  context.index_uri("file:///defs.rb", {
650
658
  r"
651
659
  module Foo
@@ -668,7 +676,7 @@ mod constant_alias_tests {
668
676
 
669
677
  #[test]
670
678
  fn resolving_constant_reference_through_top_level_alias_target() {
671
- let mut context = GraphTest::new();
679
+ let mut context = graph_test();
672
680
  context.index_uri("file:///defs.rb", {
673
681
  r"
674
682
  module Foo
@@ -688,7 +696,7 @@ mod constant_alias_tests {
688
696
  // Regression test: defining singleton method on alias triggers get_or_create_singleton_class
689
697
  #[test]
690
698
  fn resolving_singleton_method_on_alias_does_not_panic() {
691
- let mut context = GraphTest::new();
699
+ let mut context = graph_test();
692
700
  context.index_uri("file:///foo.rb", {
693
701
  r"
694
702
  class Foo; end
@@ -703,7 +711,7 @@ mod constant_alias_tests {
703
711
 
704
712
  #[test]
705
713
  fn resolving_instance_variable_on_alias_does_not_panic() {
706
- let mut context = GraphTest::new();
714
+ let mut context = graph_test();
707
715
  context.index_uri("file:///foo.rb", {
708
716
  r"
709
717
  class Foo; end
@@ -721,7 +729,7 @@ mod constant_alias_tests {
721
729
  fn method_call_on_namespace_alias() {
722
730
  // When a method call occurs in a constant alias to a namespace, the singleton class has to be created for the
723
731
  // target namespace and not for the alias
724
- let mut context = GraphTest::new();
732
+ let mut context = graph_test();
725
733
  context.index_uri("file:///foo.rb", {
726
734
  r"
727
735
  class Foo
@@ -741,7 +749,7 @@ mod constant_alias_tests {
741
749
 
742
750
  #[test]
743
751
  fn method_def_on_namespace_alias() {
744
- let mut context = GraphTest::new();
752
+ let mut context = graph_test();
745
753
  context.index_uri("file:///foo.rb", {
746
754
  r"
747
755
  class Foo
@@ -763,7 +771,7 @@ mod constant_alias_tests {
763
771
 
764
772
  #[test]
765
773
  fn re_opening_constant_alias_as_class() {
766
- let mut context = GraphTest::new();
774
+ let mut context = graph_test();
767
775
  context.index_uri("file:///alias.rb", {
768
776
  r"
769
777
  module Foo
@@ -793,7 +801,7 @@ mod constant_alias_tests {
793
801
 
794
802
  #[test]
795
803
  fn constant_alias_reopened_as_class_with_nested_inheritance() {
796
- let mut context = GraphTest::new();
804
+ let mut context = graph_test();
797
805
  context.index_uri("file:///a.rb", {
798
806
  r"
799
807
  module Foo
@@ -815,7 +823,7 @@ mod constant_alias_tests {
815
823
 
816
824
  #[test]
817
825
  fn superclass_through_alias() {
818
- let mut context = GraphTest::new();
826
+ let mut context = graph_test();
819
827
  context.index_uri("file:///a.rb", {
820
828
  r"
821
829
  class Base; end
@@ -830,7 +838,7 @@ mod constant_alias_tests {
830
838
 
831
839
  #[test]
832
840
  fn mixin_through_alias() {
833
- let mut context = GraphTest::new();
841
+ let mut context = graph_test();
834
842
  context.index_uri("file:///a.rb", {
835
843
  r"
836
844
  module M; end
@@ -847,7 +855,7 @@ mod constant_alias_tests {
847
855
 
848
856
  #[test]
849
857
  fn including_unresolved_alias() {
850
- let mut context = GraphTest::new();
858
+ let mut context = graph_test();
851
859
  context.index_uri("file:///a.rb", {
852
860
  r"
853
861
  module Foo; end
@@ -865,7 +873,7 @@ mod constant_alias_tests {
865
873
 
866
874
  #[test]
867
875
  fn prepending_unresolved_alias() {
868
- let mut context = GraphTest::new();
876
+ let mut context = graph_test();
869
877
  context.index_uri("file:///a.rb", {
870
878
  r"
871
879
  module Foo; end
@@ -883,7 +891,7 @@ mod constant_alias_tests {
883
891
 
884
892
  #[test]
885
893
  fn inheriting_unresolved_alias() {
886
- let mut context = GraphTest::new();
894
+ let mut context = graph_test();
887
895
  context.index_uri("file:///a.rb", {
888
896
  r"
889
897
  module Foo; end
@@ -900,7 +908,7 @@ mod constant_alias_tests {
900
908
 
901
909
  #[test]
902
910
  fn re_opening_unresolved_alias() {
903
- let mut context = GraphTest::new();
911
+ let mut context = graph_test();
904
912
  context.index_uri("file:///a.rb", {
905
913
  r"
906
914
  module Foo; end
@@ -934,7 +942,7 @@ mod constant_alias_tests {
934
942
 
935
943
  #[test]
936
944
  fn re_opening_namespace_alias() {
937
- let mut context = GraphTest::new();
945
+ let mut context = graph_test();
938
946
  context.index_uri("file:///a.rb", {
939
947
  r"
940
948
  module Foo; end
@@ -976,7 +984,7 @@ mod superclass_tests {
976
984
 
977
985
  #[test]
978
986
  fn linearizing_super_classes() {
979
- let mut context = GraphTest::new();
987
+ let mut context = graph_test();
980
988
  context.index_uri("file:///foo.rb", {
981
989
  r"
982
990
  class Foo; end
@@ -998,7 +1006,7 @@ mod superclass_tests {
998
1006
 
999
1007
  #[test]
1000
1008
  fn descendants_are_tracked_for_parent_classes() {
1001
- let mut context = GraphTest::new();
1009
+ let mut context = graph_test();
1002
1010
  context.index_uri("file:///foo.rb", {
1003
1011
  r"
1004
1012
  class Foo
@@ -1026,7 +1034,7 @@ mod superclass_tests {
1026
1034
 
1027
1035
  #[test]
1028
1036
  fn linearizing_circular_super_classes() {
1029
- let mut context = GraphTest::new();
1037
+ let mut context = graph_test();
1030
1038
  context.index_uri("file:///foo.rb", {
1031
1039
  r"
1032
1040
  class Foo < Bar; end
@@ -1043,7 +1051,7 @@ mod superclass_tests {
1043
1051
 
1044
1052
  #[test]
1045
1053
  fn resolving_a_constant_inherited_from_the_super_class() {
1046
- let mut context = GraphTest::new();
1054
+ let mut context = graph_test();
1047
1055
  context.index_uri("file:///foo.rb", {
1048
1056
  r"
1049
1057
  class Foo
@@ -1064,7 +1072,7 @@ mod superclass_tests {
1064
1072
 
1065
1073
  #[test]
1066
1074
  fn does_not_loop_forever_on_non_existing_parents() {
1067
- let mut context = GraphTest::new();
1075
+ let mut context = graph_test();
1068
1076
  context.index_uri("file:///foo.rb", {
1069
1077
  r"
1070
1078
  class Bar < Foo
@@ -1085,7 +1093,7 @@ mod superclass_tests {
1085
1093
 
1086
1094
  #[test]
1087
1095
  fn resolving_inherited_constant_dependent_on_complex_parent() {
1088
- let mut context = GraphTest::new();
1096
+ let mut context = graph_test();
1089
1097
  context.index_uri("file:///foo.rb", {
1090
1098
  r"
1091
1099
  module Foo
@@ -1109,7 +1117,7 @@ mod superclass_tests {
1109
1117
 
1110
1118
  #[test]
1111
1119
  fn linearizing_parent_classes_with_parent_scope() {
1112
- let mut context = GraphTest::new();
1120
+ let mut context = graph_test();
1113
1121
  context.index_uri("file:///foo.rb", {
1114
1122
  r"
1115
1123
  module Foo
@@ -1129,7 +1137,7 @@ mod superclass_tests {
1129
1137
 
1130
1138
  #[test]
1131
1139
  fn references_with_parent_scope_search_inheritance() {
1132
- let mut context = GraphTest::new();
1140
+ let mut context = graph_test();
1133
1141
  context.index_uri("file:///foo.rb", {
1134
1142
  r"
1135
1143
  module Foo
@@ -1152,7 +1160,7 @@ mod superclass_tests {
1152
1160
 
1153
1161
  #[test]
1154
1162
  fn ancestors_for_unresolved_parent_class() {
1155
- let mut context = GraphTest::new();
1163
+ let mut context = graph_test();
1156
1164
  context.index_uri(
1157
1165
  "file:///foo.rb",
1158
1166
  "
@@ -1185,7 +1193,7 @@ mod include_tests {
1185
1193
 
1186
1194
  #[test]
1187
1195
  fn resolving_constant_references_involved_in_includes() {
1188
- let mut context = GraphTest::new();
1196
+ let mut context = graph_test();
1189
1197
  context.index_uri("file:///foo.rb", {
1190
1198
  r"
1191
1199
  module Foo; end
@@ -1203,7 +1211,7 @@ mod include_tests {
1203
1211
 
1204
1212
  #[test]
1205
1213
  fn resolving_include_using_inherited_constant() {
1206
- let mut context = GraphTest::new();
1214
+ let mut context = graph_test();
1207
1215
  context.index_uri("file:///foo.rb", {
1208
1216
  r"
1209
1217
  module Foo
@@ -1228,7 +1236,7 @@ mod include_tests {
1228
1236
 
1229
1237
  #[test]
1230
1238
  fn linearizing_included_modules() {
1231
- let mut context = GraphTest::new();
1239
+ let mut context = graph_test();
1232
1240
  context.index_uri("file:///foo.rb", {
1233
1241
  r"
1234
1242
  module Foo; end
@@ -1256,7 +1264,7 @@ mod include_tests {
1256
1264
 
1257
1265
  #[test]
1258
1266
  fn include_on_dynamic_namespace_definitions() {
1259
- let mut context = GraphTest::new();
1267
+ let mut context = graph_test();
1260
1268
  context.index_uri("file:///foo.rb", {
1261
1269
  r"
1262
1270
  module B; end
@@ -1286,7 +1294,7 @@ mod include_tests {
1286
1294
 
1287
1295
  #[test]
1288
1296
  fn cyclic_include() {
1289
- let mut context = GraphTest::new();
1297
+ let mut context = graph_test();
1290
1298
  context.index_uri("file:///foo.rb", {
1291
1299
  r"
1292
1300
  module Foo
@@ -1303,7 +1311,7 @@ mod include_tests {
1303
1311
 
1304
1312
  #[test]
1305
1313
  fn duplicate_includes() {
1306
- let mut context = GraphTest::new();
1314
+ let mut context = graph_test();
1307
1315
  context.index_uri("file:///foo.rb", {
1308
1316
  r"
1309
1317
  module Foo
@@ -1324,7 +1332,7 @@ mod include_tests {
1324
1332
 
1325
1333
  #[test]
1326
1334
  fn indirect_duplicate_includes() {
1327
- let mut context = GraphTest::new();
1335
+ let mut context = graph_test();
1328
1336
  context.index_uri("file:///foo.rb", {
1329
1337
  r"
1330
1338
  module A; end
@@ -1355,7 +1363,7 @@ mod include_tests {
1355
1363
 
1356
1364
  #[test]
1357
1365
  fn includes_involving_parent_scopes() {
1358
- let mut context = GraphTest::new();
1366
+ let mut context = graph_test();
1359
1367
  context.index_uri("file:///foo.rb", {
1360
1368
  r"
1361
1369
  module A
@@ -1389,7 +1397,7 @@ mod include_tests {
1389
1397
 
1390
1398
  #[test]
1391
1399
  fn duplicate_includes_in_parents() {
1392
- let mut context = GraphTest::new();
1400
+ let mut context = graph_test();
1393
1401
  context.index_uri("file:///foo.rb", {
1394
1402
  r"
1395
1403
  module A; end
@@ -1420,7 +1428,7 @@ mod include_tests {
1420
1428
 
1421
1429
  #[test]
1422
1430
  fn included_modules_involved_in_definitions() {
1423
- let mut context = GraphTest::new();
1431
+ let mut context = graph_test();
1424
1432
  context.index_uri("file:///foo.rb", {
1425
1433
  r"
1426
1434
  module Foo
@@ -1448,7 +1456,7 @@ mod include_tests {
1448
1456
 
1449
1457
  #[test]
1450
1458
  fn multiple_mixins_in_same_include() {
1451
- let mut context = GraphTest::new();
1459
+ let mut context = graph_test();
1452
1460
  context.index_uri("file:///foo.rb", {
1453
1461
  r"
1454
1462
  module A; end
@@ -1468,7 +1476,7 @@ mod include_tests {
1468
1476
 
1469
1477
  #[test]
1470
1478
  fn descendants_are_tracked_for_includes() {
1471
- let mut context = GraphTest::new();
1479
+ let mut context = graph_test();
1472
1480
  context.index_uri("file:///foo.rb", {
1473
1481
  r"
1474
1482
  module Foo; end
@@ -1494,7 +1502,7 @@ mod prepend_tests {
1494
1502
 
1495
1503
  #[test]
1496
1504
  fn resolving_constant_references_involved_in_prepends() {
1497
- let mut context = GraphTest::new();
1505
+ let mut context = graph_test();
1498
1506
 
1499
1507
  // To linearize the ancestors of `Bar`, we need to resolve `Foo` first. However, during that resolution, we need
1500
1508
  // to check `Bar`'s ancestor chain before checking the top level (which is where we'll find `Foo`). In these
@@ -1516,7 +1524,7 @@ mod prepend_tests {
1516
1524
 
1517
1525
  #[test]
1518
1526
  fn resolving_prepend_using_inherited_constant() {
1519
- let mut context = GraphTest::new();
1527
+ let mut context = graph_test();
1520
1528
  // Prepending `Foo` makes `Bar` available, which we can then prepend as well. This requires resolving constants
1521
1529
  // with partially linearized ancestors
1522
1530
  context.index_uri("file:///foo.rb", {
@@ -1543,7 +1551,7 @@ mod prepend_tests {
1543
1551
 
1544
1552
  #[test]
1545
1553
  fn linearizing_prepended_modules() {
1546
- let mut context = GraphTest::new();
1554
+ let mut context = graph_test();
1547
1555
  context.index_uri("file:///foo.rb", {
1548
1556
  r"
1549
1557
  module Foo; end
@@ -1571,7 +1579,7 @@ mod prepend_tests {
1571
1579
 
1572
1580
  #[test]
1573
1581
  fn prepend_on_dynamic_namespace_definitions() {
1574
- let mut context = GraphTest::new();
1582
+ let mut context = graph_test();
1575
1583
  context.index_uri("file:///foo.rb", {
1576
1584
  r"
1577
1585
  module B; end
@@ -1601,7 +1609,7 @@ mod prepend_tests {
1601
1609
 
1602
1610
  #[test]
1603
1611
  fn prepends_track_descendants() {
1604
- let mut context = GraphTest::new();
1612
+ let mut context = graph_test();
1605
1613
  context.index_uri("file:///foo.rb", {
1606
1614
  r"
1607
1615
  module Foo; end
@@ -1623,7 +1631,7 @@ mod prepend_tests {
1623
1631
 
1624
1632
  #[test]
1625
1633
  fn cyclic_prepend() {
1626
- let mut context = GraphTest::new();
1634
+ let mut context = graph_test();
1627
1635
  context.index_uri("file:///foo.rb", {
1628
1636
  r"
1629
1637
  module Foo
@@ -1640,7 +1648,7 @@ mod prepend_tests {
1640
1648
 
1641
1649
  #[test]
1642
1650
  fn duplicate_prepends() {
1643
- let mut context = GraphTest::new();
1651
+ let mut context = graph_test();
1644
1652
  context.index_uri("file:///foo.rb", {
1645
1653
  r"
1646
1654
  module Foo
@@ -1661,7 +1669,7 @@ mod prepend_tests {
1661
1669
 
1662
1670
  #[test]
1663
1671
  fn indirect_duplicate_prepends() {
1664
- let mut context = GraphTest::new();
1672
+ let mut context = graph_test();
1665
1673
  context.index_uri("file:///foo.rb", {
1666
1674
  r"
1667
1675
  module A; end
@@ -1692,7 +1700,7 @@ mod prepend_tests {
1692
1700
 
1693
1701
  #[test]
1694
1702
  fn multiple_mixins_in_same_prepend() {
1695
- let mut context = GraphTest::new();
1703
+ let mut context = graph_test();
1696
1704
  context.index_uri("file:///foo.rb", {
1697
1705
  r"
1698
1706
  module A; end
@@ -1712,7 +1720,7 @@ mod prepend_tests {
1712
1720
 
1713
1721
  #[test]
1714
1722
  fn prepends_involving_parent_scopes() {
1715
- let mut context = GraphTest::new();
1723
+ let mut context = graph_test();
1716
1724
  context.index_uri("file:///foo.rb", {
1717
1725
  r"
1718
1726
  module A
@@ -1746,7 +1754,7 @@ mod prepend_tests {
1746
1754
 
1747
1755
  #[test]
1748
1756
  fn duplicate_prepends_in_parents() {
1749
- let mut context = GraphTest::new();
1757
+ let mut context = graph_test();
1750
1758
  context.index_uri("file:///foo.rb", {
1751
1759
  r"
1752
1760
  module A; end
@@ -1777,7 +1785,7 @@ mod prepend_tests {
1777
1785
 
1778
1786
  #[test]
1779
1787
  fn prepended_modules_involved_in_definitions() {
1780
- let mut context = GraphTest::new();
1788
+ let mut context = graph_test();
1781
1789
  context.index_uri("file:///foo.rb", {
1782
1790
  r"
1783
1791
  module Foo
@@ -1809,7 +1817,7 @@ mod mixin_dedup_tests {
1809
1817
 
1810
1818
  #[test]
1811
1819
  fn duplicate_includes_and_prepends() {
1812
- let mut context = GraphTest::new();
1820
+ let mut context = graph_test();
1813
1821
  context.index_uri("file:///foo.rb", {
1814
1822
  r"
1815
1823
  module A; end
@@ -1835,7 +1843,7 @@ mod mixin_dedup_tests {
1835
1843
 
1836
1844
  #[test]
1837
1845
  fn duplicate_indirect_includes_and_prepends() {
1838
- let mut context = GraphTest::new();
1846
+ let mut context = graph_test();
1839
1847
  context.index_uri("file:///foo.rb", {
1840
1848
  r"
1841
1849
  module A; end
@@ -1899,7 +1907,7 @@ mod mixin_dedup_tests {
1899
1907
 
1900
1908
  #[test]
1901
1909
  fn duplicate_includes_and_prepends_through_parents() {
1902
- let mut context = GraphTest::new();
1910
+ let mut context = graph_test();
1903
1911
  context.index_uri("file:///foo.rb", {
1904
1912
  r"
1905
1913
  module A; end
@@ -1939,7 +1947,7 @@ mod object_ancestors_tests {
1939
1947
 
1940
1948
  #[test]
1941
1949
  fn ancestors_with_missing_core() {
1942
- let mut context = GraphTest::new();
1950
+ let mut context = graph_test();
1943
1951
  context.index_uri(
1944
1952
  "file:///foo.rb",
1945
1953
  "
@@ -1958,7 +1966,7 @@ mod object_ancestors_tests {
1958
1966
 
1959
1967
  #[test]
1960
1968
  fn ancestor_patches_to_object_are_correctly_processed() {
1961
- let mut context = GraphTest::new();
1969
+ let mut context = graph_test();
1962
1970
  context.index_uri(
1963
1971
  "file:///foo.rb",
1964
1972
  "
@@ -1976,7 +1984,7 @@ mod object_ancestors_tests {
1976
1984
 
1977
1985
  #[test]
1978
1986
  fn basic_object_ancestors() {
1979
- let mut context = GraphTest::new();
1987
+ let mut context = graph_test();
1980
1988
  context.index_uri(
1981
1989
  "file:///foo.rb",
1982
1990
  "
@@ -1991,7 +1999,7 @@ mod object_ancestors_tests {
1991
1999
 
1992
2000
  #[test]
1993
2001
  fn basic_object_ancestors_including_kernel() {
1994
- let mut context = GraphTest::new();
2002
+ let mut context = graph_test();
1995
2003
  context.index_uri(
1996
2004
  "file:///foo.rb",
1997
2005
  "
@@ -2007,7 +2015,7 @@ mod object_ancestors_tests {
2007
2015
 
2008
2016
  #[test]
2009
2017
  fn constant_resolution_inside_basic_object() {
2010
- let mut context = GraphTest::new();
2018
+ let mut context = graph_test();
2011
2019
  context.index_uri("file:///foo.rb", {
2012
2020
  r"
2013
2021
  class String; end
@@ -2025,7 +2033,7 @@ mod object_ancestors_tests {
2025
2033
 
2026
2034
  #[test]
2027
2035
  fn top_level_scope_searches_object_ancestors() {
2028
- let mut context = GraphTest::new();
2036
+ let mut context = graph_test();
2029
2037
  context.index_uri("file:///foo.rb", {
2030
2038
  r"
2031
2039
  module Kernel
@@ -2049,7 +2057,7 @@ mod object_ancestors_tests {
2049
2057
 
2050
2058
  #[test]
2051
2059
  fn top_level_script_constant_resolution_searches_object_ancestors() {
2052
- let mut context = GraphTest::new();
2060
+ let mut context = graph_test();
2053
2061
  context.index_uri("file:///foo.rb", {
2054
2062
  r"
2055
2063
  module Kernel
@@ -2071,7 +2079,7 @@ mod object_ancestors_tests {
2071
2079
 
2072
2080
  #[test]
2073
2081
  fn module_own_ancestors_take_priority_over_object_fallback() {
2074
- let mut context = GraphTest::new();
2082
+ let mut context = graph_test();
2075
2083
  context.index_uri("file:///foo.rb", {
2076
2084
  r"
2077
2085
  module MyConstants
@@ -2100,7 +2108,7 @@ mod object_ancestors_tests {
2100
2108
 
2101
2109
  #[test]
2102
2110
  fn object_inherited_constant_inside_module() {
2103
- let mut context = GraphTest::new();
2111
+ let mut context = graph_test();
2104
2112
  context.index_uri("file:///foo.rb", {
2105
2113
  r"
2106
2114
  module Kernel
@@ -2132,7 +2140,7 @@ mod singleton_ancestors_tests {
2132
2140
 
2133
2141
  #[test]
2134
2142
  fn singleton_ancestors_for_classes() {
2135
- let mut context = GraphTest::new();
2143
+ let mut context = graph_test();
2136
2144
  context.index_uri("file:///foo.rb", {
2137
2145
  r"
2138
2146
  module Foo; end
@@ -2199,7 +2207,7 @@ mod singleton_ancestors_tests {
2199
2207
 
2200
2208
  #[test]
2201
2209
  fn singleton_ancestors_for_modules() {
2202
- let mut context = GraphTest::new();
2210
+ let mut context = graph_test();
2203
2211
  context.index_uri("file:///foo.rb", {
2204
2212
  r"
2205
2213
  module Foo; end
@@ -2249,7 +2257,7 @@ mod singleton_ancestors_tests {
2249
2257
 
2250
2258
  #[test]
2251
2259
  fn singleton_ancestors_with_inherited_parent_modules() {
2252
- let mut context = GraphTest::new();
2260
+ let mut context = graph_test();
2253
2261
  context.index_uri("file:///foo.rb", {
2254
2262
  r"
2255
2263
  module Foo; end
@@ -2330,7 +2338,7 @@ mod singleton_ancestors_tests {
2330
2338
 
2331
2339
  #[test]
2332
2340
  fn singleton_ancestor_chain_cascades_through_intermediate_class() {
2333
- let mut context = GraphTest::new();
2341
+ let mut context = graph_test();
2334
2342
  context.index_uri(
2335
2343
  "file:///foo.rb",
2336
2344
  r"
@@ -2366,7 +2374,7 @@ mod singleton_ancestors_tests {
2366
2374
 
2367
2375
  #[test]
2368
2376
  fn extend_creates_singleton_class() {
2369
- let mut context = GraphTest::new();
2377
+ let mut context = graph_test();
2370
2378
  context.index_uri(
2371
2379
  "file:///foo.rb",
2372
2380
  "
@@ -2399,7 +2407,7 @@ mod singleton_ancestors_tests {
2399
2407
 
2400
2408
  #[test]
2401
2409
  fn extend_creates_singleton_class_with_existing_singleton_method() {
2402
- let mut context = GraphTest::new();
2410
+ let mut context = graph_test();
2403
2411
  context.index_uri(
2404
2412
  "file:///foo.rb",
2405
2413
  "
@@ -2434,7 +2442,7 @@ mod singleton_ancestors_tests {
2434
2442
 
2435
2443
  #[test]
2436
2444
  fn extend_creates_singleton_class_on_module() {
2437
- let mut context = GraphTest::new();
2445
+ let mut context = graph_test();
2438
2446
  context.index_uri(
2439
2447
  "file:///foo.rb",
2440
2448
  "
@@ -2457,7 +2465,7 @@ mod singleton_ancestors_tests {
2457
2465
 
2458
2466
  #[test]
2459
2467
  fn singleton_class_created_in_remaining_definitions_has_linearized_ancestors() {
2460
- let mut context = GraphTest::new();
2468
+ let mut context = graph_test();
2461
2469
  context.index_uri(
2462
2470
  "file:///foo.rb",
2463
2471
  r"
@@ -2491,7 +2499,7 @@ mod method_tests {
2491
2499
 
2492
2500
  #[test]
2493
2501
  fn resolution_for_method_with_receiver() {
2494
- let mut context = GraphTest::new();
2502
+ let mut context = graph_test();
2495
2503
  context.index_uri("file:///foo.rb", {
2496
2504
  r"
2497
2505
  class Foo
@@ -2525,7 +2533,7 @@ mod method_tests {
2525
2533
 
2526
2534
  #[test]
2527
2535
  fn resolution_for_self_method_with_same_name_instance_method() {
2528
- let mut context = GraphTest::new();
2536
+ let mut context = graph_test();
2529
2537
  context.index_uri(
2530
2538
  "file:///foo.rb",
2531
2539
  r"
@@ -2545,7 +2553,7 @@ mod method_tests {
2545
2553
 
2546
2554
  #[test]
2547
2555
  fn resolution_for_self_method_alias_with_same_name_instance_method() {
2548
- let mut context = GraphTest::new();
2556
+ let mut context = graph_test();
2549
2557
  context.index_rbs_uri(
2550
2558
  "file:///foo.rbs",
2551
2559
  r"
@@ -2567,7 +2575,7 @@ mod method_tests {
2567
2575
 
2568
2576
  #[test]
2569
2577
  fn resolving_method_defined_inside_method() {
2570
- let mut context = GraphTest::new();
2578
+ let mut context = graph_test();
2571
2579
  context.index_uri("file:///foo.rb", {
2572
2580
  r"
2573
2581
  class Foo
@@ -2587,7 +2595,7 @@ mod method_tests {
2587
2595
 
2588
2596
  #[test]
2589
2597
  fn resolving_attr_accessors_inside_method() {
2590
- let mut context = GraphTest::new();
2598
+ let mut context = graph_test();
2591
2599
  context.index_uri("file:///foo.rb", {
2592
2600
  r"
2593
2601
  class Foo
@@ -2615,7 +2623,7 @@ mod method_alias_tests {
2615
2623
 
2616
2624
  #[test]
2617
2625
  fn resolving_method_alias() {
2618
- let mut context = GraphTest::new();
2626
+ let mut context = graph_test();
2619
2627
  context.index_uri("file:///foo.rb", {
2620
2628
  r"
2621
2629
  class Foo
@@ -2635,7 +2643,7 @@ mod method_alias_tests {
2635
2643
  #[test]
2636
2644
  fn resolving_method_alias_with_self_receiver() {
2637
2645
  // SelfReceiver resolves to instance methods (the class directly), not the singleton
2638
- let mut context = GraphTest::new();
2646
+ let mut context = graph_test();
2639
2647
  context.index_uri("file:///foo.rb", {
2640
2648
  r"
2641
2649
  class Foo
@@ -2654,7 +2662,7 @@ mod method_alias_tests {
2654
2662
  #[test]
2655
2663
  fn resolving_alias_method_in_singleton_class_lands_on_singleton() {
2656
2664
  // `class << self; alias_method ...; end` — alias lands on singleton via lexical nesting
2657
- let mut context = GraphTest::new();
2665
+ let mut context = graph_test();
2658
2666
  context.index_uri("file:///foo.rb", {
2659
2667
  r"
2660
2668
  class Foo
@@ -2676,7 +2684,7 @@ mod method_alias_tests {
2676
2684
  #[test]
2677
2685
  fn resolving_self_alias_method_is_equivalent_to_bare_alias_method() {
2678
2686
  // `self.alias_method` and bare `alias_method` resolve identically (instance methods)
2679
- let mut context = GraphTest::new();
2687
+ let mut context = graph_test();
2680
2688
  context.index_uri("file:///with_self.rb", {
2681
2689
  r"
2682
2690
  class WithSelf
@@ -2704,7 +2712,7 @@ mod method_alias_tests {
2704
2712
 
2705
2713
  #[test]
2706
2714
  fn resolving_method_alias_with_constant_receiver() {
2707
- let mut context = GraphTest::new();
2715
+ let mut context = graph_test();
2708
2716
  context.index_uri("file:///foo.rb", {
2709
2717
  r"
2710
2718
  class Bar
@@ -2727,7 +2735,7 @@ mod method_alias_tests {
2727
2735
 
2728
2736
  #[test]
2729
2737
  fn resolving_global_variable_alias() {
2730
- let mut context = GraphTest::new();
2738
+ let mut context = graph_test();
2731
2739
  context.index_uri("file:///foo.rb", {
2732
2740
  r"
2733
2741
  $foo = 123
@@ -2747,7 +2755,7 @@ mod method_alias_tests {
2747
2755
 
2748
2756
  #[test]
2749
2757
  fn resolving_global_variable_alias_inside_method() {
2750
- let mut context = GraphTest::new();
2758
+ let mut context = graph_test();
2751
2759
  context.index_uri("file:///foo.rb", {
2752
2760
  r"
2753
2761
  class Foo
@@ -2775,7 +2783,7 @@ mod variable_tests {
2775
2783
 
2776
2784
  #[test]
2777
2785
  fn resolution_for_class_variable_in_nested_singleton_class() {
2778
- let mut context = GraphTest::new();
2786
+ let mut context = graph_test();
2779
2787
  context.index_uri("file:///foo.rb", {
2780
2788
  r"
2781
2789
  class Foo
@@ -2799,7 +2807,7 @@ mod variable_tests {
2799
2807
 
2800
2808
  #[test]
2801
2809
  fn resolution_for_class_variable_in_method() {
2802
- let mut context = GraphTest::new();
2810
+ let mut context = graph_test();
2803
2811
  context.index_uri("file:///foo.rb", {
2804
2812
  r"
2805
2813
  class Foo
@@ -2818,7 +2826,7 @@ mod variable_tests {
2818
2826
 
2819
2827
  #[test]
2820
2828
  fn resolution_for_class_variable_only_follows_lexical_nesting() {
2821
- let mut context = GraphTest::new();
2829
+ let mut context = graph_test();
2822
2830
  context.index_uri("file:///foo.rb", {
2823
2831
  r"
2824
2832
  class Foo; end
@@ -2845,7 +2853,7 @@ mod variable_tests {
2845
2853
 
2846
2854
  #[test]
2847
2855
  fn resolution_for_class_variable_at_top_level() {
2848
- let mut context = GraphTest::new();
2856
+ let mut context = graph_test();
2849
2857
  context.index_uri("file:///foo.rb", {
2850
2858
  r"
2851
2859
  @@var = 123
@@ -2861,7 +2869,7 @@ mod variable_tests {
2861
2869
 
2862
2870
  #[test]
2863
2871
  fn resolution_for_instance_and_class_instance_variables() {
2864
- let mut context = GraphTest::new();
2872
+ let mut context = graph_test();
2865
2873
  context.index_uri("file:///foo.rb", {
2866
2874
  r"
2867
2875
  class Foo
@@ -2899,7 +2907,7 @@ mod variable_tests {
2899
2907
 
2900
2908
  #[test]
2901
2909
  fn resolution_for_instance_variables_with_dynamic_method_owner() {
2902
- let mut context = GraphTest::new();
2910
+ let mut context = graph_test();
2903
2911
  context.index_uri("file:///foo.rb", {
2904
2912
  r"
2905
2913
  class Foo
@@ -2928,7 +2936,7 @@ mod variable_tests {
2928
2936
 
2929
2937
  #[test]
2930
2938
  fn resolution_for_class_instance_variable_in_compact_namespace() {
2931
- let mut context = GraphTest::new();
2939
+ let mut context = graph_test();
2932
2940
  context.index_uri("file:///foo.rb", {
2933
2941
  r"
2934
2942
  class Bar; end
@@ -2950,7 +2958,7 @@ mod variable_tests {
2950
2958
 
2951
2959
  #[test]
2952
2960
  fn resolution_for_instance_variable_in_singleton_class_body() {
2953
- let mut context = GraphTest::new();
2961
+ let mut context = graph_test();
2954
2962
  context.index_uri("file:///foo.rb", {
2955
2963
  r"
2956
2964
  class Foo
@@ -2974,7 +2982,7 @@ mod variable_tests {
2974
2982
 
2975
2983
  #[test]
2976
2984
  fn resolution_for_instance_variable_in_constant_receiver_method() {
2977
- let mut context = GraphTest::new();
2985
+ let mut context = graph_test();
2978
2986
  context.index_uri(
2979
2987
  "file:///foo.rb",
2980
2988
  r"
@@ -2995,7 +3003,7 @@ mod variable_tests {
2995
3003
 
2996
3004
  #[test]
2997
3005
  fn resolution_for_top_level_instance_variable() {
2998
- let mut context = GraphTest::new();
3006
+ let mut context = graph_test();
2999
3007
  context.index_uri("file:///foo.rb", {
3000
3008
  r"
3001
3009
  @foo = 0
@@ -3012,7 +3020,7 @@ mod variable_tests {
3012
3020
 
3013
3021
  #[test]
3014
3022
  fn resolution_for_instance_variable_with_unresolved_receiver() {
3015
- let mut context = GraphTest::new();
3023
+ let mut context = graph_test();
3016
3024
  context.index_uri("file:///foo.rb", {
3017
3025
  r"
3018
3026
  class Foo
@@ -3040,7 +3048,7 @@ mod declaration_creation_tests {
3040
3048
 
3041
3049
  #[test]
3042
3050
  fn resolution_creates_global_declaration() {
3043
- let mut context = GraphTest::new();
3051
+ let mut context = graph_test();
3044
3052
  context.index_uri("file:///foo.rb", {
3045
3053
  r"
3046
3054
  module Foo
@@ -3068,7 +3076,7 @@ mod declaration_creation_tests {
3068
3076
 
3069
3077
  #[test]
3070
3078
  fn resolution_for_non_constant_declarations() {
3071
- let mut context = GraphTest::new();
3079
+ let mut context = graph_test();
3072
3080
  context.index_uri("file:///foo.rb", {
3073
3081
  r"
3074
3082
  class Foo
@@ -3094,7 +3102,7 @@ mod declaration_creation_tests {
3094
3102
  //
3095
3103
  // If `bar.rb` is loaded first, then `Bar` resolves to top level `Bar` and `Bar::Baz` is defined, completely
3096
3104
  // escaping the `Foo` nesting.
3097
- let mut context = GraphTest::new();
3105
+ let mut context = graph_test();
3098
3106
  context.index_uri("file:///foo.rb", {
3099
3107
  r"
3100
3108
  module Foo
@@ -3122,7 +3130,7 @@ mod declaration_creation_tests {
3122
3130
 
3123
3131
  #[test]
3124
3132
  fn expected_name_depth_order() {
3125
- let mut context = GraphTest::new();
3133
+ let mut context = graph_test();
3126
3134
  context.index_uri("file:///foo.rb", {
3127
3135
  r"
3128
3136
  module Foo
@@ -3178,7 +3186,7 @@ mod singleton_class_tests {
3178
3186
 
3179
3187
  #[test]
3180
3188
  fn resolution_for_singleton_class() {
3181
- let mut context = GraphTest::new();
3189
+ let mut context = graph_test();
3182
3190
  context.index_uri("file:///foo.rb", {
3183
3191
  r"
3184
3192
  class Foo
@@ -3203,7 +3211,7 @@ mod singleton_class_tests {
3203
3211
 
3204
3212
  #[test]
3205
3213
  fn resolution_for_nested_singleton_class() {
3206
- let mut context = GraphTest::new();
3214
+ let mut context = graph_test();
3207
3215
  context.index_uri("file:///foo.rb", {
3208
3216
  r"
3209
3217
  class Foo
@@ -3231,7 +3239,7 @@ mod singleton_class_tests {
3231
3239
 
3232
3240
  #[test]
3233
3241
  fn resolution_for_singleton_class_of_external_constant() {
3234
- let mut context = GraphTest::new();
3242
+ let mut context = graph_test();
3235
3243
  context.index_uri("file:///foo.rb", {
3236
3244
  r"
3237
3245
  class Foo; end
@@ -3261,7 +3269,7 @@ mod singleton_class_tests {
3261
3269
 
3262
3270
  #[test]
3263
3271
  fn singleton_class_is_set() {
3264
- let mut context = GraphTest::new();
3272
+ let mut context = graph_test();
3265
3273
  context.index_uri("file:///foo.rb", {
3266
3274
  r"
3267
3275
  class Foo
@@ -3281,7 +3289,7 @@ mod singleton_class_tests {
3281
3289
 
3282
3290
  #[test]
3283
3291
  fn incomplete_method_calls_automatically_trigger_singleton_creation() {
3284
- let mut context = GraphTest::new();
3292
+ let mut context = graph_test();
3285
3293
  context.index_uri("file:///foo.rb", {
3286
3294
  r"
3287
3295
  class Foo
@@ -3312,7 +3320,7 @@ mod singleton_class_tests {
3312
3320
 
3313
3321
  #[test]
3314
3322
  fn singleton_class_calls_create_nested_singletons() {
3315
- let mut context = GraphTest::new();
3323
+ let mut context = graph_test();
3316
3324
  context.index_uri("file:///foo.rb", {
3317
3325
  r"
3318
3326
  class Foo
@@ -3351,7 +3359,7 @@ mod singleton_class_tests {
3351
3359
 
3352
3360
  #[test]
3353
3361
  fn singleton_class_on_a_scoped_constant() {
3354
- let mut context = GraphTest::new();
3362
+ let mut context = graph_test();
3355
3363
  context.index_uri("file:///foo.rb", {
3356
3364
  r"
3357
3365
  module Foo
@@ -3388,7 +3396,7 @@ mod singleton_class_tests {
3388
3396
 
3389
3397
  #[test]
3390
3398
  fn singleton_class_on_a_self_call() {
3391
- let mut context = GraphTest::new();
3399
+ let mut context = graph_test();
3392
3400
  context.index_uri("file:///foo.rb", {
3393
3401
  r"
3394
3402
  class Foo
@@ -3428,7 +3436,7 @@ mod singleton_class_tests {
3428
3436
  fn resolves_sibling_constant_inside_singleton_class_method_body() {
3429
3437
  // Constant referenced from inside a method defined in `class << self` must resolve against
3430
3438
  // the lexical scope that encloses the singleton class block, not stop at the singleton class.
3431
- let mut context = GraphTest::new();
3439
+ let mut context = graph_test();
3432
3440
  context.index_uri("file:///foo.rb", {
3433
3441
  r"
3434
3442
  module A
@@ -3456,7 +3464,7 @@ mod singleton_class_tests {
3456
3464
  fn resolves_sibling_constant_inside_nested_singleton_class() {
3457
3465
  // Nested `class << self` inside a nested class: lookup must still walk outward through
3458
3466
  // every enclosing lexical scope to find a sibling defined far above.
3459
- let mut context = GraphTest::new();
3467
+ let mut context = graph_test();
3460
3468
  context.index_uri("file:///foo.rb", {
3461
3469
  r"
3462
3470
  module A
@@ -3486,7 +3494,7 @@ mod singleton_class_tests {
3486
3494
  fn resolves_sibling_constant_directly_in_singleton_class_body() {
3487
3495
  // Constant referenced directly in the `class << self` body (not inside a method) — e.g.
3488
3496
  // passed as an argument to a class-level DSL call — must also resolve lexically.
3489
- let mut context = GraphTest::new();
3497
+ let mut context = graph_test();
3490
3498
  context.index_uri("file:///foo.rb", {
3491
3499
  r"
3492
3500
  module A
@@ -3512,7 +3520,7 @@ mod singleton_class_tests {
3512
3520
  fn singleton_class_lexical_scope_still_resolves_sibling_from_other_scopes() {
3513
3521
  // Sanity / non-regression: a sibling constant must continue to resolve from every other
3514
3522
  // scope where it already worked (instance method body, class body, top level).
3515
- let mut context = GraphTest::new();
3523
+ let mut context = graph_test();
3516
3524
  context.index_uri("file:///foo.rb", {
3517
3525
  r"
3518
3526
  module A
@@ -3544,7 +3552,7 @@ mod singleton_class_tests {
3544
3552
  fn singleton_class_scope_does_not_over_resolve_unknown_constant() {
3545
3553
  // Sanity: a constant that genuinely does not exist must remain unresolved even with the
3546
3554
  // fix in place — the fix must not invent resolutions by walking too far.
3547
- let mut context = GraphTest::new();
3555
+ let mut context = graph_test();
3548
3556
  context.index_uri("file:///foo.rb", {
3549
3557
  r"
3550
3558
  module A
@@ -3570,7 +3578,7 @@ mod fqn_and_naming_tests {
3570
3578
 
3571
3579
  #[test]
3572
3580
  fn distinct_declarations_with_conflicting_string_ids() {
3573
- let mut context = GraphTest::new();
3581
+ let mut context = graph_test();
3574
3582
  context.index_uri("file:///foo.rb", {
3575
3583
  r"
3576
3584
  class Foo
@@ -3593,7 +3601,7 @@ mod fqn_and_naming_tests {
3593
3601
 
3594
3602
  #[test]
3595
3603
  fn fully_qualified_names_are_unique() {
3596
- let mut context = GraphTest::new();
3604
+ let mut context = graph_test();
3597
3605
  context.index_uri("file:///foo.rb", {
3598
3606
  r"
3599
3607
  module Foo
@@ -3663,7 +3671,7 @@ mod fqn_and_naming_tests {
3663
3671
 
3664
3672
  #[test]
3665
3673
  fn test_nested_same_names() {
3666
- let mut context = GraphTest::new();
3674
+ let mut context = graph_test();
3667
3675
  context.index_uri("file:///foo.rb", {
3668
3676
  r"
3669
3677
  module Foo; end
@@ -3697,7 +3705,7 @@ mod todo_tests {
3697
3705
 
3698
3706
  #[test]
3699
3707
  fn resolution_does_not_loop_infinitely_on_non_existing_constants() {
3700
- let mut context = GraphTest::new();
3708
+ let mut context = graph_test();
3701
3709
  context.index_uri("file:///foo.rb", {
3702
3710
  r"
3703
3711
  class Foo::Bar
@@ -3724,7 +3732,7 @@ mod todo_tests {
3724
3732
 
3725
3733
  #[test]
3726
3734
  fn resolve_missing_declaration_to_todo() {
3727
- let mut context = GraphTest::new();
3735
+ let mut context = graph_test();
3728
3736
  context.index_uri("file:///foo.rb", {
3729
3737
  r"
3730
3738
  class Foo::Bar
@@ -3756,7 +3764,7 @@ mod todo_tests {
3756
3764
 
3757
3765
  #[test]
3758
3766
  fn qualified_name_inside_nesting_resolves_when_discovered_incrementally() {
3759
- let mut context = GraphTest::new();
3767
+ let mut context = graph_test();
3760
3768
  context.index_uri("file:///baz.rb", {
3761
3769
  r"
3762
3770
  module Foo
@@ -3790,7 +3798,7 @@ mod todo_tests {
3790
3798
 
3791
3799
  #[test]
3792
3800
  fn promoted_to_real_namespace() {
3793
- let mut context = GraphTest::new();
3801
+ let mut context = graph_test();
3794
3802
  context.index_uri("file:///foo.rb", {
3795
3803
  r"
3796
3804
  class Foo::Bar
@@ -3820,7 +3828,7 @@ mod todo_tests {
3820
3828
 
3821
3829
  #[test]
3822
3830
  fn promoted_to_real_namespace_incrementally() {
3823
- let mut context = GraphTest::new();
3831
+ let mut context = graph_test();
3824
3832
  context.index_uri("file:///bar.rb", {
3825
3833
  r"
3826
3834
  class Foo::Bar
@@ -3859,7 +3867,7 @@ mod todo_tests {
3859
3867
  #[test]
3860
3868
  fn two_levels_unknown() {
3861
3869
  // class A::B::C — neither A nor B exist. Both should become Todos, C is a Class.
3862
- let mut context = GraphTest::new();
3870
+ let mut context = graph_test();
3863
3871
  context.index_uri("file:///a.rb", {
3864
3872
  r"
3865
3873
  class A::B::C
@@ -3885,7 +3893,7 @@ mod todo_tests {
3885
3893
  #[test]
3886
3894
  fn three_levels_unknown() {
3887
3895
  // class A::B::C::D — A, B, C are all unknown. Tests recursion beyond depth 2.
3888
- let mut context = GraphTest::new();
3896
+ let mut context = graph_test();
3889
3897
  context.index_uri("file:///a.rb", {
3890
3898
  r"
3891
3899
  class A::B::C::D
@@ -3913,7 +3921,7 @@ mod todo_tests {
3913
3921
  #[test]
3914
3922
  fn partially_unresolvable() {
3915
3923
  // A exists but B doesn't — A resolves to a real Module, B becomes a Todo under A.
3916
- let mut context = GraphTest::new();
3924
+ let mut context = graph_test();
3917
3925
  context.index_uri("file:///a.rb", {
3918
3926
  r"
3919
3927
  module A; end
@@ -3936,7 +3944,7 @@ mod todo_tests {
3936
3944
  fn shared_by_sibling_classes() {
3937
3945
  // Two classes share the same unknown parent chain. The Todos for A and B should
3938
3946
  // be created once and reused, with both C and D as members of B.
3939
- let mut context = GraphTest::new();
3947
+ let mut context = graph_test();
3940
3948
  context.index_uri("file:///a.rb", {
3941
3949
  r"
3942
3950
  class A::B::C
@@ -3974,7 +3982,7 @@ mod todo_tests {
3974
3982
  // clears all declarations and re-resolves from scratch. This test verifies that
3975
3983
  // the promotion works when both files are present during the second resolution pass,
3976
3984
  // not that Todos are surgically updated in place.
3977
- let mut context = GraphTest::new();
3985
+ let mut context = graph_test();
3978
3986
  context.index_uri("file:///c.rb", {
3979
3987
  r"
3980
3988
  class A::B::C
@@ -4011,7 +4019,7 @@ mod todo_tests {
4011
4019
  fn with_self_method_and_ivar() {
4012
4020
  // def self.foo with @x inside a multi-level compact class — the SelfReceiver
4013
4021
  // on the method must find C's declaration to create the singleton class and ivar.
4014
- let mut context = GraphTest::new();
4022
+ let mut context = graph_test();
4015
4023
  context.index_uri("file:///a.rb", {
4016
4024
  r"
4017
4025
  class A::B::C
@@ -4034,7 +4042,7 @@ mod todo_tests {
4034
4042
  fn nested_inside_module_with_separate_intermediate() {
4035
4043
  // Compact namespace nested inside a module, where the intermediate namespace
4036
4044
  // is defined separately. Bar::Baz should become a Todo since only Bar exists.
4037
- let mut context = GraphTest::new();
4045
+ let mut context = graph_test();
4038
4046
  context.index_uri("file:///a.rb", {
4039
4047
  r"
4040
4048
  module Foo
@@ -4060,7 +4068,7 @@ mod todo_tests {
4060
4068
  // Baz::Qux inside Foo, where Baz comes from included Bar module.
4061
4069
  // Baz::Qux should resolve through inheritance to Bar::Baz::Qux, not create
4062
4070
  // a top-level Baz Todo.
4063
- let mut context = GraphTest::new();
4071
+ let mut context = graph_test();
4064
4072
  context.index_uri("file:///file1.rb", {
4065
4073
  r"
4066
4074
  module Foo
@@ -4091,7 +4099,7 @@ mod todo_tests {
4091
4099
 
4092
4100
  #[test]
4093
4101
  fn intermediate_todo_on_constant_alias() {
4094
- let mut context = GraphTest::new();
4102
+ let mut context = graph_test();
4095
4103
  context.index_uri("file:///alias.rb", {
4096
4104
  r"
4097
4105
  module Bar; end
@@ -4118,7 +4126,7 @@ mod todo_tests {
4118
4126
 
4119
4127
  #[test]
4120
4128
  fn rbs_method_definition() {
4121
- let mut context = GraphTest::new();
4129
+ let mut context = graph_test();
4122
4130
  context.index_rbs_uri("file:///foo.rbs", {
4123
4131
  r"
4124
4132
  class Foo
@@ -4141,7 +4149,7 @@ mod todo_tests {
4141
4149
  fn resolves_constant_with_ancestors_partial() {
4142
4150
  // B has Ancestors::Partial because its prepend is defined in another file.
4143
4151
  // X must wait for B's ancestors to resolve, then resolve to A::X.
4144
- let mut context = GraphTest::new();
4152
+ let mut context = graph_test();
4145
4153
  context.index_uri("file:///1.rb", {
4146
4154
  r"
4147
4155
  module A
@@ -4174,7 +4182,7 @@ mod todo_tests {
4174
4182
  fn resolves_constant_with_ancestor_partial() {
4175
4183
  // C has an Ancestor::Partial entry because O::A is defined in another file.
4176
4184
  // X must wait for O::A to resolve, then resolve to O::A::X.
4177
- let mut context = GraphTest::new();
4185
+ let mut context = graph_test();
4178
4186
  context.index_uri("file:///1.rb", {
4179
4187
  r"
4180
4188
  class B
@@ -4206,7 +4214,7 @@ mod todo_tests {
4206
4214
 
4207
4215
  #[test]
4208
4216
  fn method_call_on_undefined_constant() {
4209
- let mut context = GraphTest::new();
4217
+ let mut context = graph_test();
4210
4218
  context.index_uri("file:///foo.rb", {
4211
4219
  r"
4212
4220
  Foo.bar
@@ -4220,7 +4228,7 @@ mod todo_tests {
4220
4228
 
4221
4229
  #[test]
4222
4230
  fn qualified_name_inside_nesting_resolves_to_top_level() {
4223
- let mut context = GraphTest::new();
4231
+ let mut context = graph_test();
4224
4232
  context.index_uri("file:///foo.rb", {
4225
4233
  r"
4226
4234
  module Foo
@@ -4258,7 +4266,7 @@ mod dynamic_namespace_tests {
4258
4266
  //
4259
4267
  // We need to ensure that the associated Declaration for Bar is transformed into a class if any of its
4260
4268
  // definitions represent one, otherwise we have no place to store the includes and ancestors
4261
- let mut context = GraphTest::new();
4269
+ let mut context = graph_test();
4262
4270
  context.index_uri("file:///foo.rb", {
4263
4271
  r"
4264
4272
  module Baz; end
@@ -4279,7 +4287,7 @@ mod dynamic_namespace_tests {
4279
4287
 
4280
4288
  #[test]
4281
4289
  fn resolving_accessing_meta_programming_class() {
4282
- let mut context = GraphTest::new();
4290
+ let mut context = graph_test();
4283
4291
  context.index_uri("file:///foo.rb", {
4284
4292
  r"
4285
4293
  Foo = Protobuf.some_dynamic_class
@@ -4293,7 +4301,7 @@ mod dynamic_namespace_tests {
4293
4301
 
4294
4302
  #[test]
4295
4303
  fn inheriting_from_dynamic_class() {
4296
- let mut context = GraphTest::new();
4304
+ let mut context = graph_test();
4297
4305
  context.index_uri("file:///foo.rb", {
4298
4306
  r"
4299
4307
  Foo = some_dynamic_class
@@ -4309,7 +4317,7 @@ mod dynamic_namespace_tests {
4309
4317
 
4310
4318
  #[test]
4311
4319
  fn including_dynamic_module() {
4312
- let mut context = GraphTest::new();
4320
+ let mut context = graph_test();
4313
4321
  context.index_uri("file:///foo.rb", {
4314
4322
  r"
4315
4323
  Foo = some_dynamic_module
@@ -4326,7 +4334,7 @@ mod dynamic_namespace_tests {
4326
4334
 
4327
4335
  #[test]
4328
4336
  fn prepending_dynamic_module() {
4329
- let mut context = GraphTest::new();
4337
+ let mut context = graph_test();
4330
4338
  context.index_uri("file:///foo.rb", {
4331
4339
  r"
4332
4340
  Foo = some_dynamic_module
@@ -4343,7 +4351,7 @@ mod dynamic_namespace_tests {
4343
4351
 
4344
4352
  #[test]
4345
4353
  fn extending_dynamic_module() {
4346
- let mut context = GraphTest::new();
4354
+ let mut context = graph_test();
4347
4355
  context.index_uri("file:///foo.rb", {
4348
4356
  r"
4349
4357
  Foo = some_dynamic_module
@@ -4376,7 +4384,7 @@ mod dynamic_namespace_tests {
4376
4384
 
4377
4385
  #[test]
4378
4386
  fn ancestor_operations_on_meta_programming_class() {
4379
- let mut context = GraphTest::new();
4387
+ let mut context = graph_test();
4380
4388
  context.index_uri("file:///foo.rb", {
4381
4389
  r"
4382
4390
  module Foo; end
@@ -4399,7 +4407,7 @@ mod promotability_tests {
4399
4407
 
4400
4408
  #[test]
4401
4409
  fn non_promotable_constant_not_promoted_to_class_with_members() {
4402
- let mut context = GraphTest::new();
4410
+ let mut context = graph_test();
4403
4411
  context.index_uri("file:///foo.rb", {
4404
4412
  r"
4405
4413
  FOO = 42
@@ -4416,7 +4424,7 @@ mod promotability_tests {
4416
4424
 
4417
4425
  #[test]
4418
4426
  fn non_promotable_constant_not_promoted_to_module() {
4419
- let mut context = GraphTest::new();
4427
+ let mut context = graph_test();
4420
4428
  context.index_uri("file:///foo.rb", {
4421
4429
  r#"
4422
4430
  FOO = "hello"
@@ -4432,7 +4440,7 @@ mod promotability_tests {
4432
4440
 
4433
4441
  #[test]
4434
4442
  fn promotable_constant_is_promoted_to_class() {
4435
- let mut context = GraphTest::new();
4443
+ let mut context = graph_test();
4436
4444
  context.index_uri("file:///foo.rb", {
4437
4445
  r"
4438
4446
  module Baz; end
@@ -4454,7 +4462,7 @@ mod promotability_tests {
4454
4462
  fn mixed_promotable_and_non_promotable_blocks_promotion() {
4455
4463
  // If the same constant has both a promotable and non-promotable definition,
4456
4464
  // promotion should be blocked
4457
- let mut context = GraphTest::new();
4465
+ let mut context = graph_test();
4458
4466
  context.index_uri("file:///a.rb", "Foo = some_call");
4459
4467
  context.index_uri("file:///b.rb", "Foo = 42");
4460
4468
  context.index_uri("file:///c.rb", "class Foo; end");
@@ -4466,7 +4474,7 @@ mod promotability_tests {
4466
4474
 
4467
4475
  #[test]
4468
4476
  fn promotable_constant_promoted_to_module() {
4469
- let mut context = GraphTest::new();
4477
+ let mut context = graph_test();
4470
4478
  context.index_uri("file:///foo.rb", {
4471
4479
  r"
4472
4480
  module Baz; end
@@ -4486,7 +4494,7 @@ mod promotability_tests {
4486
4494
 
4487
4495
  #[test]
4488
4496
  fn class_first_then_constant_stays_namespace() {
4489
- let mut context = GraphTest::new();
4497
+ let mut context = graph_test();
4490
4498
  context.index_uri("file:///foo.rb", {
4491
4499
  r"
4492
4500
  class Foo; end
@@ -4501,7 +4509,7 @@ mod promotability_tests {
4501
4509
 
4502
4510
  #[test]
4503
4511
  fn promotable_constant_path_write() {
4504
- let mut context = GraphTest::new();
4512
+ let mut context = graph_test();
4505
4513
  context.index_uri("file:///foo.rb", {
4506
4514
  r"
4507
4515
  module A; end
@@ -4517,7 +4525,7 @@ mod promotability_tests {
4517
4525
 
4518
4526
  #[test]
4519
4527
  fn method_call_on_promotable_constant() {
4520
- let mut context = GraphTest::new();
4528
+ let mut context = graph_test();
4521
4529
  context.index_uri("file:///foo.rb", {
4522
4530
  r"
4523
4531
  Qux = some_factory_call
@@ -4532,7 +4540,7 @@ mod promotability_tests {
4532
4540
 
4533
4541
  #[test]
4534
4542
  fn singleton_method_on_non_promotable_constant_does_not_crash() {
4535
- let mut context = GraphTest::new();
4543
+ let mut context = graph_test();
4536
4544
  context.index_uri("file:///foo.rb", {
4537
4545
  r"
4538
4546
  FOO = 42
@@ -4547,7 +4555,7 @@ mod promotability_tests {
4547
4555
 
4548
4556
  #[test]
4549
4557
  fn def_self_on_promotable_constant() {
4550
- let mut context = GraphTest::new();
4558
+ let mut context = graph_test();
4551
4559
  context.index_uri("file:///foo.rb", {
4552
4560
  r"
4553
4561
  Qux = some_factory_call
@@ -4565,7 +4573,7 @@ mod promotability_tests {
4565
4573
  // When a promotable constant is auto-promoted via singleton class access, we conservatively
4566
4574
  // promote to a module (not a class) since we don't know what the call returns.
4567
4575
  // Modules don't inherit from Object.
4568
- let mut context = GraphTest::new();
4576
+ let mut context = graph_test();
4569
4577
  context.index_uri("file:///foo.rb", {
4570
4578
  r"
4571
4579
  Foo = some_factory_call
@@ -4580,7 +4588,7 @@ mod promotability_tests {
4580
4588
 
4581
4589
  #[test]
4582
4590
  fn meta_programming_class_with_members() {
4583
- let mut context = GraphTest::new();
4591
+ let mut context = graph_test();
4584
4592
  context.index_uri("file:///foo.rb", {
4585
4593
  r"
4586
4594
  Foo = dynamic_class do
@@ -4597,7 +4605,7 @@ mod promotability_tests {
4597
4605
 
4598
4606
  #[test]
4599
4607
  fn self_method_inside_non_promotable_constant() {
4600
- let mut context = GraphTest::new();
4608
+ let mut context = graph_test();
4601
4609
  context.index_uri("file:///a.rb", {
4602
4610
  r"
4603
4611
  CONST = 1
@@ -4615,7 +4623,7 @@ mod promotability_tests {
4615
4623
 
4616
4624
  #[test]
4617
4625
  fn defining_constant_in_promotable_constant() {
4618
- let mut context = GraphTest::new();
4626
+ let mut context = graph_test();
4619
4627
  context.index_uri("file:///a.rb", {
4620
4628
  r"
4621
4629
  Foo = dynamic
@@ -4632,7 +4640,7 @@ mod promotability_tests {
4632
4640
 
4633
4641
  #[test]
4634
4642
  fn singleton_class_block_for_promotable_constant() {
4635
- let mut context = GraphTest::new();
4643
+ let mut context = graph_test();
4636
4644
  context.index_uri("file:///a.rb", {
4637
4645
  r"
4638
4646
  Foo = dynamic
@@ -4650,7 +4658,7 @@ mod promotability_tests {
4650
4658
 
4651
4659
  #[test]
4652
4660
  fn singleton_class_block_for_non_promotable_constant() {
4653
- let mut context = GraphTest::new();
4661
+ let mut context = graph_test();
4654
4662
  context.index_uri("file:///a.rb", {
4655
4663
  r"
4656
4664
  Foo = 1
@@ -4673,7 +4681,7 @@ mod rbs_tests {
4673
4681
 
4674
4682
  #[test]
4675
4683
  fn rbs_module_and_class_declarations() {
4676
- let mut context = GraphTest::new();
4684
+ let mut context = graph_test();
4677
4685
  context.index_rbs_uri("file:///test.rbs", {
4678
4686
  r"
4679
4687
  module Foo
@@ -4693,7 +4701,7 @@ mod rbs_tests {
4693
4701
 
4694
4702
  #[test]
4695
4703
  fn rbs_nested_declarations() {
4696
- let mut context = GraphTest::new();
4704
+ let mut context = graph_test();
4697
4705
  context.index_rbs_uri("file:///test.rbs", {
4698
4706
  r"
4699
4707
  module Foo
@@ -4720,7 +4728,7 @@ mod rbs_tests {
4720
4728
 
4721
4729
  #[test]
4722
4730
  fn rbs_qualified_module_name() {
4723
- let mut context = GraphTest::new();
4731
+ let mut context = graph_test();
4724
4732
  context.index_rbs_uri("file:///parents.rbs", {
4725
4733
  r"
4726
4734
  module Foo
@@ -4744,7 +4752,7 @@ mod rbs_tests {
4744
4752
 
4745
4753
  #[test]
4746
4754
  fn rbs_qualified_name_inside_nested_module() {
4747
- let mut context = GraphTest::new();
4755
+ let mut context = graph_test();
4748
4756
  context.index_rbs_uri("file:///foo.rbs", {
4749
4757
  r"
4750
4758
  module Outer
@@ -4770,7 +4778,7 @@ mod rbs_tests {
4770
4778
 
4771
4779
  #[test]
4772
4780
  fn rbs_superclass_resolution() {
4773
- let mut context = GraphTest::new();
4781
+ let mut context = graph_test();
4774
4782
  context.index_rbs_uri("file:///test.rbs", {
4775
4783
  r"
4776
4784
  class Foo
@@ -4802,7 +4810,7 @@ mod rbs_tests {
4802
4810
 
4803
4811
  #[test]
4804
4812
  fn rbs_constant_declarations() {
4805
- let mut context = GraphTest::new();
4813
+ let mut context = graph_test();
4806
4814
  context.index_rbs_uri("file:///test.rbs", {
4807
4815
  r"
4808
4816
  FOO: String
@@ -4833,7 +4841,7 @@ mod rbs_tests {
4833
4841
 
4834
4842
  #[test]
4835
4843
  fn rbs_global_declaration() {
4836
- let mut context = GraphTest::new();
4844
+ let mut context = graph_test();
4837
4845
  context.index_rbs_uri("file:///test.rbs", "$foo: String");
4838
4846
  context.resolve();
4839
4847
 
@@ -4848,7 +4856,7 @@ mod rbs_tests {
4848
4856
 
4849
4857
  #[test]
4850
4858
  fn rbs_mixin_resolution() {
4851
- let mut context = GraphTest::new();
4859
+ let mut context = graph_test();
4852
4860
  context.index_rbs_uri("file:///test.rbs", {
4853
4861
  r"
4854
4862
  module Bar
@@ -4872,7 +4880,7 @@ mod rbs_tests {
4872
4880
 
4873
4881
  #[test]
4874
4882
  fn rbs_method_alias_resolution() {
4875
- let mut context = GraphTest::new();
4883
+ let mut context = graph_test();
4876
4884
  context.index_uri("file:///foo.rb", {
4877
4885
  r"
4878
4886
  class Foo
@@ -4928,7 +4936,7 @@ mod visibility_resolution_tests {
4928
4936
 
4929
4937
  #[test]
4930
4938
  fn retroactive_visibility_override_applies_in_source_order() {
4931
- let mut context = GraphTest::new();
4939
+ let mut context = graph_test();
4932
4940
  context.index_uri(
4933
4941
  "file:///foo.rb",
4934
4942
  r"
@@ -4947,7 +4955,7 @@ mod visibility_resolution_tests {
4947
4955
 
4948
4956
  #[test]
4949
4957
  fn retroactive_visibility_on_direct_method() {
4950
- let mut context = GraphTest::new();
4958
+ let mut context = graph_test();
4951
4959
  context.index_uri(
4952
4960
  "file:///foo.rb",
4953
4961
  r"
@@ -4973,7 +4981,7 @@ mod visibility_resolution_tests {
4973
4981
 
4974
4982
  #[test]
4975
4983
  fn retroactive_visibility_on_attr_methods() {
4976
- let mut context = GraphTest::new();
4984
+ let mut context = graph_test();
4977
4985
  context.index_uri(
4978
4986
  "file:///foo.rb",
4979
4987
  r"
@@ -4999,7 +5007,7 @@ mod visibility_resolution_tests {
4999
5007
 
5000
5008
  #[test]
5001
5009
  fn retroactive_visibility_on_inherited_method() {
5002
- let mut context = GraphTest::new();
5010
+ let mut context = graph_test();
5003
5011
  context.index_uri(
5004
5012
  "file:///foo.rb",
5005
5013
  r"
@@ -5024,7 +5032,7 @@ mod visibility_resolution_tests {
5024
5032
 
5025
5033
  #[test]
5026
5034
  fn retroactive_visibility_on_grandparent_method() {
5027
- let mut context = GraphTest::new();
5035
+ let mut context = graph_test();
5028
5036
  context.index_uri(
5029
5037
  "file:///foo.rb",
5030
5038
  r"
@@ -5048,7 +5056,7 @@ mod visibility_resolution_tests {
5048
5056
 
5049
5057
  #[test]
5050
5058
  fn retroactive_visibility_on_included_module_method() {
5051
- let mut context = GraphTest::new();
5059
+ let mut context = graph_test();
5052
5060
  context.index_uri(
5053
5061
  "file:///foo.rb",
5054
5062
  r"
@@ -5071,7 +5079,7 @@ mod visibility_resolution_tests {
5071
5079
 
5072
5080
  #[test]
5073
5081
  fn retroactive_visibility_on_undefined_method_emits_diagnostic() {
5074
- let mut context = GraphTest::new();
5082
+ let mut context = graph_test();
5075
5083
  context.index_uri(
5076
5084
  "file:///foo.rb",
5077
5085
  r"
@@ -5092,7 +5100,7 @@ mod visibility_resolution_tests {
5092
5100
 
5093
5101
  #[test]
5094
5102
  fn retroactive_visibility_across_reopened_class() {
5095
- let mut context = GraphTest::new();
5103
+ let mut context = graph_test();
5096
5104
  context.index_uri(
5097
5105
  "file:///a.rb",
5098
5106
  r"
@@ -5117,7 +5125,7 @@ mod visibility_resolution_tests {
5117
5125
 
5118
5126
  #[test]
5119
5127
  fn retroactive_visibility_resolves_when_ancestor_discovered_incrementally() {
5120
- let mut context = GraphTest::new();
5128
+ let mut context = graph_test();
5121
5129
  context.index_uri(
5122
5130
  "file:///child.rb",
5123
5131
  r"
@@ -5150,7 +5158,7 @@ mod visibility_resolution_tests {
5150
5158
 
5151
5159
  #[test]
5152
5160
  fn retroactive_constant_visibility_on_direct_member() {
5153
- let mut context = GraphTest::new();
5161
+ let mut context = graph_test();
5154
5162
  context.index_uri(
5155
5163
  "file:///foo.rb",
5156
5164
  r"
@@ -5183,7 +5191,7 @@ mod visibility_resolution_tests {
5183
5191
 
5184
5192
  #[test]
5185
5193
  fn retroactive_constant_visibility_via_qualified_receiver() {
5186
- let mut context = GraphTest::new();
5194
+ let mut context = graph_test();
5187
5195
  context.index_uri(
5188
5196
  "file:///foo.rb",
5189
5197
  r"
@@ -5206,7 +5214,7 @@ mod visibility_resolution_tests {
5206
5214
 
5207
5215
  #[test]
5208
5216
  fn retroactive_constant_visibility_multi_arg_undefined_emits_per_name_diagnostic() {
5209
- let mut context = GraphTest::new();
5217
+ let mut context = graph_test();
5210
5218
  context.index_uri(
5211
5219
  "file:///foo.rb",
5212
5220
  r"
@@ -5228,7 +5236,7 @@ mod visibility_resolution_tests {
5228
5236
 
5229
5237
  #[test]
5230
5238
  fn retroactive_constant_visibility_inherited_constant_emits_diagnostic() {
5231
- let mut context = GraphTest::new();
5239
+ let mut context = graph_test();
5232
5240
  context.index_uri(
5233
5241
  "file:///foo.rb",
5234
5242
  r"
@@ -5254,7 +5262,7 @@ mod visibility_resolution_tests {
5254
5262
 
5255
5263
  #[test]
5256
5264
  fn retroactive_constant_visibility_clears_when_call_removed() {
5257
- let mut context = GraphTest::new();
5265
+ let mut context = graph_test();
5258
5266
  context.index_uri(
5259
5267
  "file:///foo.rb",
5260
5268
  r"
@@ -5283,7 +5291,7 @@ mod visibility_resolution_tests {
5283
5291
 
5284
5292
  #[test]
5285
5293
  fn retroactive_constant_visibility_inside_singleton_class_body() {
5286
- let mut context = GraphTest::new();
5294
+ let mut context = graph_test();
5287
5295
  context.index_uri(
5288
5296
  "file:///foo.rb",
5289
5297
  r"
@@ -5303,7 +5311,7 @@ mod visibility_resolution_tests {
5303
5311
 
5304
5312
  #[test]
5305
5313
  fn retroactive_constant_visibility_persists_across_reopened_class() {
5306
- let mut context = GraphTest::new();
5314
+ let mut context = graph_test();
5307
5315
  context.index_uri(
5308
5316
  "file:///a.rb",
5309
5317
  r"
@@ -5328,7 +5336,7 @@ mod visibility_resolution_tests {
5328
5336
 
5329
5337
  #[test]
5330
5338
  fn retroactive_singleton_method_visibility_on_direct_member() {
5331
- let mut context = GraphTest::new();
5339
+ let mut context = graph_test();
5332
5340
  context.index_uri(
5333
5341
  "file:///foo.rb",
5334
5342
  r"
@@ -5351,7 +5359,7 @@ mod visibility_resolution_tests {
5351
5359
 
5352
5360
  #[test]
5353
5361
  fn retroactive_singleton_method_visibility_on_inherited_method() {
5354
- let mut context = GraphTest::new();
5362
+ let mut context = graph_test();
5355
5363
  context.index_uri(
5356
5364
  "file:///foo.rb",
5357
5365
  r"
@@ -5374,7 +5382,7 @@ mod visibility_resolution_tests {
5374
5382
 
5375
5383
  #[test]
5376
5384
  fn retroactive_singleton_method_visibility_on_undefined_method_emits_diagnostic() {
5377
- let mut context = GraphTest::new();
5385
+ let mut context = graph_test();
5378
5386
  context.index_uri(
5379
5387
  "file:///foo.rb",
5380
5388
  r"
@@ -5395,7 +5403,7 @@ mod visibility_resolution_tests {
5395
5403
 
5396
5404
  #[test]
5397
5405
  fn retroactive_singleton_method_visibility_undefined_target_diagnostic_clears_when_file_deleted() {
5398
- let mut context = GraphTest::new();
5406
+ let mut context = graph_test();
5399
5407
  context.index_uri(
5400
5408
  "file:///foo.rb",
5401
5409
  r"
@@ -5428,7 +5436,7 @@ mod visibility_resolution_tests {
5428
5436
 
5429
5437
  #[test]
5430
5438
  fn retroactive_singleton_method_visibility_undefined_target_diagnostic_clears_when_target_added() {
5431
- let mut context = GraphTest::new();
5439
+ let mut context = graph_test();
5432
5440
  context.index_uri(
5433
5441
  "file:///foo.rb",
5434
5442
  r"