@@ -80,6 +80,20 @@ fn canonical_temp_path(path: &Path) -> PathBuf {
8080 path. canonicalize ( ) . unwrap_or_else ( |_| path. to_path_buf ( ) )
8181}
8282
83+ fn normalize_test_path ( path : & Path ) -> String {
84+ path. to_string_lossy ( )
85+ . replace ( '\\' , "/" )
86+ . trim_start_matches ( "//?/" )
87+ . to_string ( )
88+ }
89+
90+ fn assert_path_eq ( actual : impl AsRef < Path > , expected : impl AsRef < Path > ) {
91+ assert_eq ! (
92+ normalize_test_path( actual. as_ref( ) ) ,
93+ normalize_test_path( expected. as_ref( ) )
94+ ) ;
95+ }
96+
8397fn test_home ( dir : & TempDir ) -> PathBuf {
8498 let home = dir. path ( ) . join ( "home" ) ;
8599 fs:: create_dir_all ( & home) . unwrap ( ) ;
@@ -359,7 +373,7 @@ async fn config_path_uses_profile_shard_when_enrolled() {
359373 )
360374 . unwrap ( ) ;
361375
362- assert_eq ! ( get_config_path( & project) , shard_root. join( "config.json" ) ) ;
376+ assert_path_eq ( get_config_path ( & project) , shard_root. join ( "config.json" ) ) ;
363377 assert_eq ! (
364378 load_config( & project) . unwrap( ) . root_dir,
365379 "profile-shard-config"
@@ -377,9 +391,9 @@ async fn config_path_defaults_to_profile_shard_without_enrollment() {
377391 let _home_guard = HomeGuard :: set ( & home) ;
378392 let project_id = default_profile_project_id ( & project) ;
379393
380- assert_eq ! (
394+ assert_path_eq (
381395 get_config_path ( & project) ,
382- profile_root. join( format!( "projects/{project_id}/config.json" ) )
396+ profile_root. join ( format ! ( "projects/{project_id}/config.json" ) ) ,
383397 ) ;
384398}
385399
@@ -555,21 +569,21 @@ async fn resolved_project_store_helpers_route_profile_sharded_session_artifacts(
555569 let _home_guard = HomeGuard :: set ( & home) ;
556570 write_enrollment ( & project) ;
557571
558- assert_eq ! (
572+ assert_path_eq (
559573 resolve_project_session_db_path ( & project) . unwrap ( ) ,
560- profile_root. join( "projects/proj_123/sessions.db" )
574+ profile_root. join ( "projects/proj_123/sessions.db" ) ,
561575 ) ;
562- assert_eq ! (
576+ assert_path_eq (
563577 resolve_response_handle_root ( & project) . unwrap ( ) ,
564- profile_root. join( "projects/proj_123/response-handles" )
578+ profile_root. join ( "projects/proj_123/response-handles" ) ,
565579 ) ;
566- assert_eq ! (
580+ assert_path_eq (
567581 resolve_lcm_payload_root ( & project) . unwrap ( ) ,
568- profile_root. join( "projects/proj_123/lcm-payloads" )
582+ profile_root. join ( "projects/proj_123/lcm-payloads" ) ,
569583 ) ;
570- assert_eq ! (
584+ assert_path_eq (
571585 project_session_db_path ( & project) ,
572- profile_root. join( "projects/proj_123/sessions.db" )
586+ profile_root. join ( "projects/proj_123/sessions.db" ) ,
573587 ) ;
574588}
575589
@@ -584,13 +598,13 @@ async fn resolved_project_store_helpers_default_to_profile_sharded_artifact_path
584598 let _home_guard = HomeGuard :: set ( & home) ;
585599 let project_id = default_profile_project_id ( & project) ;
586600
587- assert_eq ! (
601+ assert_path_eq (
588602 resolve_project_session_db_path ( & project) . unwrap ( ) ,
589- profile_root. join( format!( "projects/{project_id}/sessions.db" ) )
603+ profile_root. join ( format ! ( "projects/{project_id}/sessions.db" ) ) ,
590604 ) ;
591- assert_eq ! (
605+ assert_path_eq (
592606 project_session_db_path ( & project) ,
593- profile_root. join( format!( "projects/{project_id}/sessions.db" ) )
607+ profile_root. join ( format ! ( "projects/{project_id}/sessions.db" ) ) ,
594608 ) ;
595609}
596610
@@ -636,8 +650,8 @@ async fn trace_decay_init_defaults_to_profile_shard_without_repo_marker() {
636650 let cg = TraceDecay :: init ( & project) . await . unwrap ( ) ;
637651
638652 assert_eq ! ( cg. store_layout( ) . storage_mode, StorageMode :: ProfileSharded ) ;
639- assert_eq ! ( cg. store_layout( ) . data_root, shard_root) ;
640- assert_eq ! ( cg. db_path( ) , shard_root. join( "tracedecay.db" ) ) ;
653+ assert_path_eq ( & cg. store_layout ( ) . data_root , & shard_root) ;
654+ assert_path_eq ( cg. db_path ( ) , shard_root. join ( "tracedecay.db" ) ) ;
641655 assert_eq ! ( discover_project_root( & child) , Some ( project. clone( ) ) ) ;
642656 assert ! ( !project. join( ".tracedecay" ) . exists( ) ) ;
643657 assert ! ( shard_root. join( "config.json" ) . exists( ) ) ;
@@ -867,7 +881,7 @@ async fn trace_decay_open_uses_profile_shard_paths_from_enrollment_marker() {
867881
868882 let opened = TraceDecay :: open ( & project) . await . unwrap ( ) ;
869883
870- assert_eq ! ( opened. db_path( ) , shard_root. join( "tracedecay.db" ) ) ;
884+ assert_path_eq ( opened. db_path ( ) , shard_root. join ( "tracedecay.db" ) ) ;
871885 assert_eq ! ( opened. get_config( ) . root_dir, project. to_string_lossy( ) ) ;
872886 assert_eq ! ( opened. serving_branch( ) , Some ( "main" ) ) ;
873887}
0 commit comments