@@ -587,22 +587,33 @@ mod tests {
587587
588588 #[ test]
589589 fn test_is_native_library ( ) {
590- // Use platform-appropriate paths for testing
591- #[ cfg( unix) ]
592- {
593- assert ! ( is_native_library( Path :: new( "/path/to/lib.so" ) ) ) ;
594- assert ! ( is_native_library( Path :: new( "/path/to/lib.dylib" ) ) ) ;
595- }
596- #[ cfg( windows) ]
597- {
598- assert ! ( is_native_library( Path :: new( "C:\\ path\\ to\\ lib.dll" ) ) ) ;
599- }
600- // These should work on all platforms
601- assert ! ( is_native_library( Path :: new( "lib.dll" ) ) ) ;
602- assert ! ( is_native_library( Path :: new( "lib.so" ) ) ) ;
603- assert ! ( is_native_library( Path :: new( "lib.dylib" ) ) ) ;
604- assert ! ( !is_native_library( Path :: new( "lib.wasm" ) ) ) ;
605- assert ! ( !is_native_library( Path :: new( "lib.js" ) ) ) ;
590+ // Create temp files to test extension checking
591+ let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
592+
593+ // Create test files with different extensions
594+ let dll_path = temp_dir. path ( ) . join ( "lib.dll" ) ;
595+ let so_path = temp_dir. path ( ) . join ( "lib.so" ) ;
596+ let dylib_path = temp_dir. path ( ) . join ( "lib.dylib" ) ;
597+ let wasm_path = temp_dir. path ( ) . join ( "lib.wasm" ) ;
598+ let js_path = temp_dir. path ( ) . join ( "lib.js" ) ;
599+
600+ std:: fs:: write ( & dll_path, "test" ) . unwrap ( ) ;
601+ std:: fs:: write ( & so_path, "test" ) . unwrap ( ) ;
602+ std:: fs:: write ( & dylib_path, "test" ) . unwrap ( ) ;
603+ std:: fs:: write ( & wasm_path, "test" ) . unwrap ( ) ;
604+ std:: fs:: write ( & js_path, "test" ) . unwrap ( ) ;
605+
606+ // Native library extensions should match
607+ assert ! ( is_native_library( & dll_path) ) ;
608+ assert ! ( is_native_library( & so_path) ) ;
609+ assert ! ( is_native_library( & dylib_path) ) ;
610+
611+ // Non-native extensions should not match
612+ assert ! ( !is_native_library( & wasm_path) ) ;
613+ assert ! ( !is_native_library( & js_path) ) ;
614+
615+ // Non-existent paths should return false
616+ assert ! ( !is_native_library( Path :: new( "nonexistent.dll" ) ) ) ;
606617 }
607618
608619 #[ tokio:: test]
0 commit comments