Skip to content

Commit

Permalink
[tests] Remove project path at the end of errors/warnings before comp…
Browse files Browse the repository at this point in the history
…aring

- msbuild adds project path at the end of errors/warnings, which xbuild didn't
do. This caused two tests to fail:

	Xamarin.MMP.Tests.MMPTests.MM0132("inline-runtime-arch")
	Xamarin.MMP.Tests.MMPTests.MM0132("foo")
  • Loading branch information
radical committed May 22, 2018
1 parent 26abe1b commit 8f0df14
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/common/ExecutionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ bool IndexOfAny (string line, out int start, out int end, params string [] value
return false;
}

string RemovePathAtEnd (string line)
{
if (line.TrimEnd ().EndsWith ("]")) {
var start = line.LastIndexOf ("[");
if (start >= 0) {
// we want to get the space before `[` too.
if (start > 0 && line [start - 1] == ' ')
start --;

line = line.Substring (0, start);
return line;
}
}

return line;
}

public void ParseMessages ()
{
messages.Clear ();
Expand All @@ -120,9 +137,11 @@ public void ParseMessages ()
msg.IsError = true;
origin = line.Substring (0, idxError);
line = line.Substring (endError);
line = RemovePathAtEnd (line);
} else if (IndexOfAny (line, out var idxWarning, out var endWarning, ": warning ", ": warning ")) {
origin = line.Substring (0, idxWarning);
line = line.Substring (endWarning);
line = RemovePathAtEnd (line);
} else if (line.StartsWith ("error ", StringComparison.Ordinal)) {
msg.IsError = true;
line = line.Substring (6);
Expand Down

0 comments on commit 8f0df14

Please sign in to comment.