File tree Expand file tree Collapse file tree
crates/fspy_detours_sys/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,13 +46,18 @@ fn detours_bindings() {
4646 . override_abi ( bindgen:: Abi :: System , ".*" )
4747 . generate ( )
4848 . expect ( "Unable to generate bindings" ) ;
49- let bindings_content = bindings. to_string ( ) ;
49+
50+ // bindgen produces raw_lines with \r\n line endings on Windows;
51+ // Git on Windows may check out files using CRLF line endings, depending on user config.
52+ // To avoid unnecessary diffs, normalize all line endings to \n.
53+ let bindings_content = bindings. to_string ( ) . replace ( "\r \n " , "\n " ) ;
5054 let bindings_path = "src/generated_bindings.rs" ;
5155
5256 if env:: var ( "FSPY_DETOURS_WRITE_BINDINGS" ) . as_deref ( ) == Ok ( "1" ) {
5357 fs:: write ( bindings_path, bindings_content) . unwrap ( ) ;
5458 } else {
55- let existing_bindings_content = fs:: read_to_string ( bindings_path) . unwrap_or_default ( ) ;
59+ let existing_bindings_content =
60+ fs:: read_to_string ( bindings_path) . unwrap_or_default ( ) . replace ( "\r \n " , "\n " ) ;
5661 assert_eq ! (
5762 existing_bindings_content, bindings_content,
5863 "Bindings are out of date. Run this test with FSPY_DETOURS_WRITE_BINDINGS=1 to update them."
You can’t perform that action at this time.
0 commit comments