aboutsummaryrefslogtreecommitdiff
path: root/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-01-02 19:00:16 -0600
committerSean Hall <r.sean.hall@gmail.com>2021-01-03 15:49:32 -0600
commitb673734cce44dd28c1d4d1810da3069324466166 (patch)
treeada7f6d994a1dbcf09e8b30b95f7b2c403a0a7f6 /src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs
parent643a5c5db1da6fb68fdc353bbbdbecaa1964425e (diff)
downloadwix-b673734cce44dd28c1d4d1810da3069324466166.tar.gz
wix-b673734cce44dd28c1d4d1810da3069324466166.tar.bz2
wix-b673734cce44dd28c1d4d1810da3069324466166.zip
Implement command line for SuppressAllWarnings and WarningsAsError.
Make WixRunner.Execute default to setting WarningsAsError to make sure tests are not accidentally causing warnings.
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs
new file mode 100644
index 00000000..c5b6c261
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/WarningFixture.cs
@@ -0,0 +1,63 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolsetTest.CoreIntegration
4{
5 using System.IO;
6 using WixBuildTools.TestSupport;
7 using WixToolset.Core.TestPackage;
8 using WixToolset.Data;
9 using Xunit;
10
11 public class WarningFixture
12 {
13 [Fact]
14 public void SuppressedWarningsWithWarningAsErrorsAreNotErrors()
15 {
16 var folder = TestData.Get(@"TestData\Payload");
17
18 using (var fs = new DisposableFileSystem())
19 {
20 var baseFolder = fs.GetFolder();
21 var intermediateFolder = Path.Combine(baseFolder, "obj");
22 var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib");
23
24 var result = WixRunner.Execute(warningsAsErrors: true, new[]
25 {
26 "build",
27 "-sw1152",
28 Path.Combine(folder, "CanonicalizeName.wxs"),
29 "-intermediateFolder", intermediateFolder,
30 "-o", wixlibPath,
31 });
32
33 result.AssertSuccess();
34 }
35 }
36
37 [Fact]
38 public void WarningsAsErrorsTreatsWarningsAsErrors()
39 {
40 var folder = TestData.Get(@"TestData\Payload");
41
42 using (var fs = new DisposableFileSystem())
43 {
44 var baseFolder = fs.GetFolder();
45 var intermediateFolder = Path.Combine(baseFolder, "obj");
46 var wixlibPath = Path.Combine(intermediateFolder, @"test.wixlib");
47
48 var result = WixRunner.Execute(warningsAsErrors: true, new[]
49 {
50 "build",
51 Path.Combine(folder, "CanonicalizeName.wxs"),
52 "-intermediateFolder", intermediateFolder,
53 "-o", wixlibPath,
54 });
55
56 Assert.Equal((int)WarningMessages.Ids.PathCanonicalized, result.ExitCode);
57
58 var message = Assert.Single(result.Messages);
59 Assert.Equal(MessageLevel.Warning, message.Level); // TODO: is this right?
60 }
61 }
62 }
63}