diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-03-15 18:09:12 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-03-16 20:14:37 -0500 |
commit | db22d99a4d603caab18fd42cb40881431c353912 (patch) | |
tree | 93085f239b881010760392d62a695f7717cebb1a /src/ext/Bal/test | |
parent | 8c9ca787bee29f969cd7ca9aeaa46626d557d196 (diff) | |
download | wix-db22d99a4d603caab18fd42cb40881431c353912.tar.gz wix-db22d99a4d603caab18fd42cb40881431c353912.tar.bz2 wix-db22d99a4d603caab18fd42cb40881431c353912.zip |
Enhance bundle backend validation.
Diffstat (limited to 'src/ext/Bal/test')
3 files changed, 24 insertions, 4 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs index ef4ee49a..9aea8c1d 100644 --- a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.Bal | 3 | namespace WixToolsetTest.Bal |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using System.Xml; | 8 | using System.Xml; |
@@ -138,20 +139,33 @@ namespace WixToolsetTest.Bal | |||
138 | { | 139 | { |
139 | var baseFolder = fs.GetFolder(); | 140 | var baseFolder = fs.GetFolder(); |
140 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | 141 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); |
141 | var bundleSourceFolder = TestData.Get(@"TestData\Overridable"); | 142 | var bundleSourceFolder = TestData.Get(@"TestData"); |
142 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | 143 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
143 | var baFolderPath = Path.Combine(baseFolder, "ba"); | 144 | var baFolderPath = Path.Combine(baseFolder, "ba"); |
144 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | 145 | var extractFolderPath = Path.Combine(baseFolder, "extract"); |
145 | 146 | ||
146 | var compileResult = WixRunner.Execute(new[] | 147 | var result = WixRunner.Execute(new[] |
147 | { | 148 | { |
148 | "build", | 149 | "build", |
149 | Path.Combine(bundleSourceFolder, "WrongCaseBundle.wxs"), | 150 | Path.Combine(bundleSourceFolder, "Overridable", "WrongCaseBundle.wxs"), |
151 | "-loc", Path.Combine(bundleSourceFolder, "Overridable", "WrongCaseBundle.wxl"), | ||
152 | "-bindpath", Path.Combine(bundleSourceFolder, "WixStdBa", "Data"), | ||
150 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | 153 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), |
151 | "-intermediateFolder", intermediateFolder, | 154 | "-intermediateFolder", intermediateFolder, |
152 | "-o", bundleFile, | 155 | "-o", bundleFile, |
153 | }); | 156 | }); |
154 | Assert.Equal((int)BalErrors.Ids.NonUpperCaseOverridableVariable, compileResult.ExitCode); | 157 | |
158 | Assert.InRange(result.ExitCode, 2, Int32.MaxValue); | ||
159 | |||
160 | var messages = result.Messages.Select(m => m.ToString()).ToList(); | ||
161 | messages.Sort(); | ||
162 | |||
163 | WixAssert.CompareLineByLine(new[] | ||
164 | { | ||
165 | "bal:Condition/@Condition contains the built-in Variable 'WixBundleAction', which is not available when it is evaluated. (Unavailable Variables are: 'WixBundleAction'.). Rewrite the condition to avoid Variables that are never valid during its evaluation.", | ||
166 | "Overridable variable 'Test1' must be 'TEST1' with Bundle/@CommandLineVariables value 'upperCase'.", | ||
167 | "The *Package/@bal:DisplayInternalUICondition attribute's value '=' is not a valid bundle condition.", | ||
168 | }, messages.ToArray()); | ||
155 | } | 169 | } |
156 | } | 170 | } |
157 | } | 171 | } |
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxl b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxl new file mode 100644 index 00000000..223a7874 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxl | |||
@@ -0,0 +1,4 @@ | |||
1 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
2 | <String Id="NonsenseDetectCondition">WixBundleAction = 4</String> | ||
3 | <String Id="NonsensePlanCondition">=</String> | ||
4 | </WixLocalization> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxs index 91380c69..547af644 100644 --- a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxs +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/WrongCaseBundle.wxs | |||
@@ -8,6 +8,8 @@ | |||
8 | <Variable Name="Test1" bal:Overridable="yes" /> | 8 | <Variable Name="Test1" bal:Overridable="yes" /> |
9 | <Chain> | 9 | <Chain> |
10 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> | 10 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> |
11 | <MsiPackage SourceFile="test.msi" bal:DisplayInternalUICondition="!(loc.NonsensePlanCondition)" /> | ||
11 | </Chain> | 12 | </Chain> |
13 | <bal:Condition Condition="!(loc.NonsenseDetectCondition)" Message="Unsupported" /> | ||
12 | </Bundle> | 14 | </Bundle> |
13 | </Wix> | 15 | </Wix> |