@@ -482,7 +482,7 @@ mod tests {
482482 fn path_from_fixture ( path : & str ) -> Result < PathBuf > {
483483 let uri_str = if cfg ! ( windows) && path. starts_with ( '/' ) {
484484 // On Windows, convert Unix-style absolute paths to Windows-style
485- format ! ( "file://C:{path}" )
485+ format ! ( "file:/// C:{path}" )
486486 } else {
487487 format ! ( "file://{path}" )
488488 } ;
@@ -551,7 +551,13 @@ mod tests {
551551 . find_map ( |document| document. cursor . map ( |cursor| ( document, cursor) ) ) ?;
552552
553553 let path = document. path . as_str ( ) ;
554- let uri = lsp_types:: Uri :: from_str ( format ! ( "file://{path}" ) . as_str ( ) ) . unwrap ( ) ;
554+ let uri_str = if cfg ! ( windows) && path. starts_with ( '/' ) {
555+ // On Windows, convert Unix-style absolute paths to Windows-style
556+ format ! ( "file:///C:{path}" )
557+ } else {
558+ format ! ( "file://{path}" )
559+ } ;
560+ let uri = lsp_types:: Uri :: from_str ( & uri_str) . unwrap ( ) ;
555561 let id = lsp_types:: TextDocumentIdentifier :: new ( uri) ;
556562 Some ( lsp_types:: TextDocumentPositionParams :: new ( id, cursor) )
557563 }
@@ -1116,10 +1122,18 @@ mod tests {
111611222023-10-01 open Assets:Test USD
11171123"# ;
11181124 let test_state = TestState :: new ( fixture) . unwrap ( ) ;
1125+
1126+ // Create a cross-platform compatible file URI
1127+ let uri_str = if cfg ! ( windows) {
1128+ // On Windows, convert Unix-style absolute paths to Windows-style
1129+ "file:///C:/main.beancount"
1130+ } else {
1131+ "file:///main.beancount"
1132+ } ;
1133+ let uri = lsp_types:: Uri :: from_str ( uri_str) . unwrap ( ) ;
1134+
11191135 let cursor = lsp_types:: TextDocumentPositionParams {
1120- text_document : lsp_types:: TextDocumentIdentifier {
1121- uri : lsp_types:: Uri :: from_str ( "file:///main.beancount" ) . unwrap ( ) ,
1122- } ,
1136+ text_document : lsp_types:: TextDocumentIdentifier { uri } ,
11231137 position : lsp_types:: Position {
11241138 line : 0 ,
11251139 character : 26 ,
0 commit comments