@@ -422,7 +422,7 @@ pub trait ArbitraryOfType: Sized {
422422pub ( crate ) mod tests {
423423 use crate :: ast:: ElementsJetHinter ;
424424 use crate :: parse:: ParseFromStr ;
425- use crate :: resolution:: tests:: canon;
425+ use crate :: resolution:: tests:: { build_map , canon} ;
426426 use crate :: resolution:: DependencyMapBuilder ;
427427 use crate :: source:: CanonPath ;
428428 use crate :: test_utils:: TempWorkspace ;
@@ -471,15 +471,15 @@ pub(crate) mod tests {
471471 {
472472 let parent = prog_path. as_ref ( ) . parent ( ) . unwrap ( ) ;
473473 let canon_root = canon ( parent) ;
474- let mut builder = DependencyMapBuilder :: new ( canon_root ) ;
474+ let mut builder = DependencyMapBuilder :: new ( ) ;
475475
476476 for ( context, alias, target) in dependencies {
477477 let context = canon ( context. as_ref ( ) ) ;
478478 let target = canon ( target. as_ref ( ) ) ;
479479
480- builder = builder . add_dependency ( context, alias. into ( ) , target) ;
480+ builder. add_dependency ( context, alias. into ( ) , target) ;
481481 }
482- builder. build ( ) . unwrap ( )
482+ builder. build ( canon_root ) . unwrap ( )
483483 }
484484
485485 pub ( crate ) struct TestCase < T > {
@@ -871,7 +871,7 @@ pub(crate) mod tests {
871871 let main_path = root. join ( MAIN ) ;
872872 let canon_root = CanonPath :: canonicalize ( & root) . unwrap ( ) ;
873873
874- let dependency_map = DependencyMapBuilder :: new ( canon_root) . build ( ) . unwrap ( ) ;
874+ let dependency_map = build_map ( & canon_root, & [ ] ) . unwrap ( ) ;
875875
876876 TestCase :: < TemplateProgram > :: template_deps ( & main_path, & dependency_map)
877877 . with_arguments ( Arguments :: default ( ) )
@@ -1304,19 +1304,15 @@ mod error_tests {
13041304 use super :: * ;
13051305
13061306 use crate :: ast:: ElementsJetHinter ;
1307- use crate :: resolution:: tests:: canon;
1308- use crate :: resolution:: DependencyMapBuilder ;
1307+ use crate :: resolution:: tests:: { build_map, canon} ;
13091308 use crate :: source:: CanonPath ;
13101309 use crate :: test_utils:: TempWorkspace ;
13111310
13121311 fn dependency_map ( root_dir : & Path , drp : & str , lib_dir : & Path ) -> DependencyMap {
13131312 let context = CanonPath :: canonicalize ( root_dir) . unwrap ( ) ;
13141313 let target = CanonPath :: canonicalize ( lib_dir) . unwrap ( ) ;
13151314
1316- DependencyMapBuilder :: new ( context. clone ( ) )
1317- . add_dependency ( context, drp. into ( ) , target)
1318- . build ( )
1319- . unwrap ( )
1315+ build_map ( & context, & [ ( & context, drp, & target) ] ) . unwrap ( )
13201316 }
13211317
13221318 fn source_file ( path : & Path ) -> CanonSourceFile {
@@ -1407,7 +1403,8 @@ mod error_tests {
14071403#[ cfg( test) ]
14081404mod functional_tests {
14091405 use crate :: ast:: ElementsJetHinter ;
1410- use crate :: resolution:: { DependencyMap , DependencyMapBuilder } ;
1406+ use crate :: resolution:: tests:: build_map;
1407+ use crate :: resolution:: DependencyMap ;
14111408 use crate :: source:: { CanonPath , CanonSourceFile } ;
14121409 use crate :: tests:: { flatten_multidep_test, run_dependency_test, run_multidep_test} ;
14131410 use crate :: { Arguments , CompiledProgram } ;
@@ -1616,12 +1613,9 @@ mod functional_tests {
16161613 let lib_canon = CanonPath :: canonicalize ( & lib_dir) . unwrap ( ) ;
16171614
16181615 // 3. Set up the dependency maps
1619- let dependency_map = DependencyMapBuilder :: new ( root_canon. clone ( ) )
1620- . add_dependency ( root_canon. clone ( ) , "lib" . to_string ( ) , lib_canon)
1621- . build ( )
1622- . unwrap ( ) ;
1616+ let dependency_map = build_map ( & root_canon, & [ ( & root_canon, "lib" , & lib_canon) ] ) . unwrap ( ) ;
16231617
1624- let no_dependency_map = DependencyMapBuilder :: new ( root_canon) . build ( ) . unwrap ( ) ;
1618+ let no_dependency_map = build_map ( & root_canon, & [ ] ) . unwrap ( ) ;
16251619
16261620 // Compile both programs reading directly from the file system
16271621 let poisoned = compile_with_deps ( & poisoned_main, & dependency_map) ;
0 commit comments