Skip to content

Commit ffa9f47

Browse files
committed
Fix a handful of oopses
1 parent bcd9278 commit ffa9f47

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
@@ -1451,7 +1451,7 @@ public MyTextObjectFont (PdfPageTextObjectFont font) : base (font)
14511451
// NativeAOT generates (twice, once per arch):
14521452
// warning IL3053: Assembly 'Mono.Android' produced AOT analysis warnings.
14531453
//
1454-
int expected = runtime switch {
1454+
uint expected = runtime switch {
14551455
AndroidRuntime.CoreCLR => 1,
14561456
AndroidRuntime.NativeAOT => 2,
14571457
_ => throw new NotSupportedException ($"Unsupported runtime '{runtime}'")

0 commit comments

Comments
 (0)