@@ -100,25 +100,29 @@ TEST_CASE("staticrequiretracer_require_graph")
100100 const auto & graph = tracer.getRequireGraph ();
101101
102102 // main.luau should require utils.luau and lib/helper.luau
103- REQUIRE (graph.count (" main.luau" ) == 1 );
104- const auto & mainDeps = graph.at (" main.luau" );
105- REQUIRE (mainDeps.size () == 2 );
106- CHECK (std::find (mainDeps.begin (), mainDeps.end (), " utils.luau" ) != mainDeps.end ());
107- CHECK (std::find (mainDeps.begin (), mainDeps.end (), " lib/helper.luau" ) != mainDeps.end ());
103+ REQUIRE (graph.contains (" main.luau" ));
104+ const auto * mainDeps = graph.find (" main.luau" );
105+ REQUIRE (mainDeps != nullptr );
106+ REQUIRE (mainDeps->size () == 2 );
107+ CHECK (std::find (mainDeps->begin (), mainDeps->end (), " utils.luau" ) != mainDeps->end ());
108+ CHECK (std::find (mainDeps->begin (), mainDeps->end (), " lib/helper.luau" ) != mainDeps->end ());
108109
109110 // lib/helper.luau should require shared.luau
110- REQUIRE (graph.count (" lib/helper.luau" ) == 1 );
111- const auto & helperDeps = graph.at (" lib/helper.luau" );
112- REQUIRE (helperDeps.size () == 1 );
113- CHECK (helperDeps[0 ] == " shared.luau" );
111+ REQUIRE (graph.contains (" lib/helper.luau" ));
112+ const auto * helperDeps = graph.find (" lib/helper.luau" );
113+ REQUIRE (helperDeps != nullptr );
114+ REQUIRE (helperDeps->size () == 1 );
115+ CHECK ((*helperDeps)[0 ] == " shared.luau" );
114116
115117 // utils.luau should have no dependencies
116- REQUIRE (graph.count (" utils.luau" ) == 1 );
117- const auto & utilsDeps = graph.at (" utils.luau" );
118- CHECK (utilsDeps.empty ());
118+ REQUIRE (graph.contains (" utils.luau" ));
119+ const auto * utilsDeps = graph.find (" utils.luau" );
120+ REQUIRE (utilsDeps != nullptr );
121+ CHECK (utilsDeps->empty ());
119122
120123 // shared.luau should have no dependencies
121- REQUIRE (graph.count (" shared.luau" ) == 1 );
122- const auto & sharedDeps = graph.at (" shared.luau" );
123- CHECK (sharedDeps.empty ());
124+ REQUIRE (graph.contains (" shared.luau" ));
125+ const auto * sharedDeps = graph.find (" shared.luau" );
126+ REQUIRE (sharedDeps != nullptr );
127+ CHECK (sharedDeps->empty ());
124128}
0 commit comments