diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-01-08 13:46:36 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-01-08 15:47:31 -0800 |
| commit | c1605aa577e304fe0fb4c57056b58754bfaf3666 (patch) | |
| tree | 2bd363058d48134ef23ddcf557d91386295baecc /src/test/WixToolsetTest.CoreIntegration | |
| parent | e35ee2e8c58bf55da5f3d04915d588fb04d6809d (diff) | |
| download | wix-c1605aa577e304fe0fb4c57056b58754bfaf3666.tar.gz wix-c1605aa577e304fe0fb4c57056b58754bfaf3666.tar.bz2 wix-c1605aa577e304fe0fb4c57056b58754bfaf3666.zip | |
Require or recommend ExePackage/@DetectCondition
Fixes wixtoolset/issues#6197
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
4 files changed, 73 insertions, 1 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExePackageFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExePackageFixture.cs new file mode 100644 index 00000000..e2306dcd --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ExePackageFixture.cs | |||
| @@ -0,0 +1,52 @@ | |||
| 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 | |||
| 3 | namespace WixToolsetTest.CoreIntegration | ||
| 4 | { | ||
| 5 | using System.IO; | ||
| 6 | using WixBuildTools.TestSupport; | ||
| 7 | using WixToolset.Core.TestPackage; | ||
| 8 | using Xunit; | ||
| 9 | |||
| 10 | public class ExePackageFixture | ||
| 11 | { | ||
| 12 | [Fact] | ||
| 13 | public void ErrorWhenMissingDetectCondition() | ||
| 14 | { | ||
| 15 | var folder = TestData.Get(@"TestData", "ExePackage"); | ||
| 16 | |||
| 17 | using (var fs = new DisposableFileSystem()) | ||
| 18 | { | ||
| 19 | var baseFolder = fs.GetFolder(); | ||
| 20 | |||
| 21 | var result = WixRunner.Execute(new[] | ||
| 22 | { | ||
| 23 | "build", | ||
| 24 | Path.Combine(folder, "MissingDetectCondition.wxs"), | ||
| 25 | "-o", Path.Combine(baseFolder, "test.wixlib") | ||
| 26 | }); | ||
| 27 | |||
| 28 | Assert.Equal(1153, result.ExitCode); | ||
| 29 | } | ||
| 30 | } | ||
| 31 | |||
| 32 | [Fact] | ||
| 33 | public void ErrorWhenRequireDetectCondition() | ||
| 34 | { | ||
| 35 | var folder = TestData.Get(@"TestData", "ExePackage"); | ||
| 36 | |||
| 37 | using (var fs = new DisposableFileSystem()) | ||
| 38 | { | ||
| 39 | var baseFolder = fs.GetFolder(); | ||
| 40 | |||
| 41 | var result = WixRunner.Execute(new[] | ||
| 42 | { | ||
| 43 | "build", | ||
| 44 | Path.Combine(folder, "RequireDetectCondition.wxs"), | ||
| 45 | "-o", Path.Combine(baseFolder, "test.wixlib") | ||
| 46 | }); | ||
| 47 | |||
| 48 | Assert.Equal(401, result.ExitCode); | ||
| 49 | } | ||
| 50 | } | ||
| 51 | } | ||
| 52 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/MissingDetectCondition.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/MissingDetectCondition.wxs new file mode 100644 index 00000000..21b4269b --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/MissingDetectCondition.wxs | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <PackageGroup Id="TestPackageGroup"> | ||
| 5 | <ExePackage InstallCommand="-install" | ||
| 6 | SourceFile="testsetup.exe" /> | ||
| 7 | </PackageGroup> | ||
| 8 | </Fragment> | ||
| 9 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/RequireDetectCondition.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/RequireDetectCondition.wxs new file mode 100644 index 00000000..42253f18 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ExePackage/RequireDetectCondition.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Fragment> | ||
| 4 | <PackageGroup Id="TestPackageGroup"> | ||
| 5 | <ExePackage DetectCondition="" | ||
| 6 | InstallCommand="-install" | ||
| 7 | UninstallCommand="-uninstall" | ||
| 8 | SourceFile="testsetup.exe" /> | ||
| 9 | </PackageGroup> | ||
| 10 | </Fragment> | ||
| 11 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExePackageGroup.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExePackageGroup.wxs index 9d7a9511..cad1f049 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExePackageGroup.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SingleExeBundle/SingleExePackageGroup.wxs | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
| 3 | <Fragment> | 3 | <Fragment> |
| 4 | <PackageGroup Id="BundlePackages"> | 4 | <PackageGroup Id="BundlePackages"> |
| 5 | <ExePackage SourceFile="burn.exe" /> | 5 | <ExePackage DetectCondition="DetectedSomething" SourceFile="burn.exe" /> |
| 6 | </PackageGroup> | 6 | </PackageGroup> |
| 7 | </Fragment> | 7 | </Fragment> |
| 8 | </Wix> | 8 | </Wix> |
