@@ -25,7 +25,7 @@ use std::fs::{self, File};
25
25
use std:: io:: BufReader ;
26
26
use std:: io:: prelude:: * ;
27
27
use std:: net:: TcpStream ;
28
- use std:: path:: { Path , PathBuf } ;
28
+ use std:: path:: { Path , PathBuf , Component } ;
29
29
use std:: process:: { Command , Output , ExitStatus } ;
30
30
31
31
pub fn run ( config : Config , testfile : & Path ) {
@@ -952,6 +952,9 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
952
952
// filename:line1:col1: line2:col2: *warning:* msg
953
953
// where line1:col1: is the starting point, line2:col2:
954
954
// is the ending point, and * represents ANSI color codes.
955
+ //
956
+ // This pattern is ambiguous on windows, because filename may contain
957
+ // a colon, so any path prefix must be detected and removed first.
955
958
for line in proc_res. stderr . lines ( ) {
956
959
let mut was_expected = false ;
957
960
let mut prev = 0 ;
@@ -1006,7 +1009,16 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError>,
1006
1009
}
1007
1010
}
1008
1011
1009
- fn is_compiler_error_or_warning ( line : & str ) -> bool {
1012
+ fn is_compiler_error_or_warning ( mut line : & str ) -> bool {
1013
+ // Remove initial prefix which may contain a colon
1014
+ let mut components = Path :: new ( line) . components ( ) ;
1015
+ if let Some ( Component :: Prefix ( _) ) = components. peek ( ) {
1016
+ components. next ( ) ;
1017
+ }
1018
+
1019
+ // Safe as path was originally constructed from a &str ^
1020
+ line = components. as_path ( ) . to_str ( ) . unwrap ( ) ;
1021
+
1010
1022
let mut i = 0 ;
1011
1023
return
1012
1024
scan_until_char ( line, ':' , & mut i) &&
0 commit comments