Skip to content

Commit cd8bf80

Browse files
committed
Fix a handful of oopses
1 parent e7a0624 commit cd8bf80

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Utilities/AssertionExtensions.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Collections.Generic;
12
using System.Diagnostics;
23
using System.IO;
34
using System.Linq;
@@ -130,19 +131,30 @@ public static void AssertEntryContents (this ZipArchive zip, string zipPath, str
130131
[DebuggerHidden]
131132
public static void AssertHasNoWarnings (this ProjectBuilder builder)
132133
{
133-
Assert.IsTrue (StringAssertEx.ContainsText (builder.LastBuildOutput, " 0 Warning(s)"), $"{builder.BuildLogFile} should have no MSBuild warnings.");
134+
AssertHasSomeWarnings (builder.LastBuildOutput, 0, builder.BuildLogFile);
135+
}
136+
137+
[DebuggerHidden]
138+
public static void AssertHasSomeWarnings (this ProjectBuilder builder, uint numOfExpectedWarnings)
139+
{
140+
AssertHasSomeWarnings (builder.LastBuildOutput, numOfExpectedWarnings, builder.BuildLogFile);
134141
}
135142

136143
[DebuggerHidden]
137144
public static void AssertHasNoWarnings (this DotNetCLI dotnet)
138145
{
139-
Assert.IsTrue (StringAssertEx.ContainsText (dotnet.LastBuildOutput, " 0 Warning(s)"), $"{dotnet.BuildLogFile} should have no MSBuild warnings.");
146+
AssertHasSomeWarnings (dotnet.LastBuildOutput, 0, dotnet.BuildLogFile);
140147
}
141148

142149
[DebuggerHidden]
143150
public static void AssertHasSomeWarnings (this DotNetCLI dotnet, uint numOfExpectedWarnings)
144151
{
145-
Assert.IsTrue (StringAssertEx.ContainsText (dotnet.LastBuildOutput, $" {numOfExpectedWarnings} Warning(s)"), $"{dotnet.BuildLogFile} should have {numOfExpectedWarnings} MSBuild warnings.");
152+
AssertHasSomeWarnings (dotnet.LastBuildOutput, numOfExpectedWarnings, dotnet.BuildLogFile);
153+
}
154+
155+
static void AssertHasSomeWarnings (IEnumerable<string> lastBuildOutput, uint numOfExpectedWarnings, string logFile)
156+
{
157+
Assert.IsTrue (StringAssertEx.ContainsText (lastBuildOutput, $" {numOfExpectedWarnings} Warning(s)"), $"{logFile} should have {numOfExpectedWarnings} MSBuild warnings.");
146158
}
147159
}
148160
}

tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1500,7 +1500,7 @@ public MyTextObjectFont (PdfPageTextObjectFont font) : base (font)
15001500
// NativeAOT generates (twice, once per arch):
15011501
// warning IL3053: Assembly 'Mono.Android' produced AOT analysis warnings.
15021502
//
1503-
int expected = runtime switch {
1503+
uint expected = runtime switch {
15041504
AndroidRuntime.CoreCLR => 1,
15051505
AndroidRuntime.NativeAOT => 2,
15061506
_ => throw new NotSupportedException ($"Unsupported runtime '{runtime}'")

0 commit comments

Comments
 (0)