diff --git a/pkg/testing/lib/src/analyze.dart b/pkg/testing/lib/src/analyze.dart index f9a23ee3f07..fd4d17f59f5 100644 --- a/pkg/testing/lib/src/analyze.dart +++ b/pkg/testing/lib/src/analyze.dart @@ -137,8 +137,8 @@ class AnalyzerDiagnostic { return kind == null ? "Malformed output from dartanalyzer:\n$message" : "${uri.toFilePath()}:$line:$startColumn: " - "${kind == 'INFO' ? 'warning: hint' : kind.toLowerCase()}:\n" - "[$code] $message"; + "${kind == 'INFO' ? 'warning: hint' : kind.toLowerCase()}:\n" + "[$code] $message"; } } @@ -169,10 +169,18 @@ Future analyzeUris( } catch (e) { topLevel = Uri.base.toFilePath(windows: false); } + if (Platform.isWindows) { + // We need lowercase comparison on Windows to match C:/path with c:/path + topLevel = topLevel.toLowerCase(); + } String toFilePath(Uri uri) { String path = uri.toFilePath(windows: false); - return path.startsWith(topLevel) ? path.substring(topLevel.length) : path; + return (Platform.isWindows + ? path.toLowerCase().startsWith(topLevel) + : path.startsWith(topLevel)) + ? path.substring(topLevel.length) + : path; } Set filesToAnalyze = new Set();