aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2019-11-14 18:10:00 -0500
committerBob Arnson <bob@firegiant.com>2019-11-14 18:14:17 -0500
commit94b3c44ea27e29253a26e18bf0c70295d0fc48e5 (patch)
tree680dedd2ec7c6c700d83e57455bd4c4ded86e4ba /src
parente34ea332def4718110e9a7efcf9e12bf7456c753 (diff)
downloadwix-94b3c44ea27e29253a26e18bf0c70295d0fc48e5.tar.gz
wix-94b3c44ea27e29253a26e18bf0c70295d0fc48e5.tar.bz2
wix-94b3c44ea27e29253a26e18bf0c70295d0fc48e5.zip
Fix EnvironmentTuple nullable fields. Add test.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Core/Compiler.cs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs44
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Environment/Environment.wxs13
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj1
4 files changed, 59 insertions, 1 deletions
diff --git a/src/WixToolset.Core/Compiler.cs b/src/WixToolset.Core/Compiler.cs
index 56d3a8b4..179c5a37 100644
--- a/src/WixToolset.Core/Compiler.cs
+++ b/src/WixToolset.Core/Compiler.cs
@@ -5203,7 +5203,7 @@ namespace WixToolset.Core
5203 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name")); 5203 this.Core.Write(ErrorMessages.ExpectedAttribute(sourceLineNumbers, node.Name.LocalName, "Name"));
5204 } 5204 }
5205 5205
5206 if (!part.HasValue && action == EnvironmentActionType.Create) 5206 if (part.HasValue && action == EnvironmentActionType.Create)
5207 { 5207 {
5208 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Part", "Action", "create")); 5208 this.Core.Write(ErrorMessages.IllegalAttributeWithOtherAttribute(sourceLineNumbers, node.Name.LocalName, "Part", "Action", "create"));
5209 } 5209 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
index 81f780dc..068ae2b7 100644
--- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
@@ -428,6 +428,41 @@ namespace WixToolsetTest.CoreIntegration
428 } 428 }
429 429
430 [Fact] 430 [Fact]
431 public void PopulatesEnvironmentTable()
432 {
433 var folder = TestData.Get(@"TestData");
434
435 using (var fs = new DisposableFileSystem())
436 {
437 var baseFolder = fs.GetFolder();
438 var intermediateFolder = Path.Combine(baseFolder, "obj");
439 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
440
441 var result = WixRunner.Execute(new[]
442 {
443 "build",
444 Path.Combine(folder, "Environment", "Environment.wxs"),
445 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
446 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
447 "-intermediateFolder", intermediateFolder,
448 "-o", msiPath
449 });
450
451 result.AssertSuccess();
452
453 Assert.True(File.Exists(msiPath));
454 var results = Query.QueryDatabase(msiPath, new[] { "Environment" });
455 Assert.Equal(new[]
456 {
457 "Environment:WixEnvironmentTest1\t=-WixEnvTest1\t\tWixEnvironmentTest",
458 "Environment:WixEnvironmentTest2\t+-WixEnvTest1\t\tWixEnvironmentTest",
459 "Environment:WixEnvironmentTest3\t!-WixEnvTest1\t\tWixEnvironmentTest",
460 "Environment:WixEnvironmentTest4\t=-*WIX\t[INSTALLFOLDER]\tWixEnvironmentTest",
461 }, results);
462 }
463 }
464
465 [Fact]
431 public void PopulatesFeatureTableWithParent() 466 public void PopulatesFeatureTableWithParent()
432 { 467 {
433 var folder = TestData.Get(@"TestData"); 468 var folder = TestData.Get(@"TestData");
@@ -942,6 +977,15 @@ namespace WixToolsetTest.CoreIntegration
942 "Upgrade:{12E4699F-E774-4D05-8A01-5BDD41BBA127}\t1.0.0.0\t\t1033\t2\t\tWIX_DOWNGRADE_DETECTED", 977 "Upgrade:{12E4699F-E774-4D05-8A01-5BDD41BBA127}\t1.0.0.0\t\t1033\t2\t\tWIX_DOWNGRADE_DETECTED",
943 "Upgrade:{B05772EA-82B8-4DE0-B7EB-45B5F0CCFE6D}\t1.0.0\t\t\t256\t\tRELPRODFOUND", 978 "Upgrade:{B05772EA-82B8-4DE0-B7EB-45B5F0CCFE6D}\t1.0.0\t\t\t256\t\tRELPRODFOUND",
944 }, results); 979 }, results);
980
981 var prefix = "Property:SecureCustomProperties\t";
982 var secureProperties = Query.QueryDatabase(msiPath, new[] { "Property" }).Where(p => p.StartsWith(prefix)).Single();
983 Assert.Equal(new[]
984 {
985 "RELPRODFOUND",
986 "WIX_DOWNGRADE_DETECTED",
987 "WIX_UPGRADE_DETECTED",
988 }, secureProperties.Substring(prefix.Length).Split(';').OrderBy(p => p));
945 } 989 }
946 } 990 }
947 } 991 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Environment/Environment.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Environment/Environment.wxs
new file mode 100644
index 00000000..284801e2
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Environment/Environment.wxs
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents">
5 <Component Id="WixEnvironmentTest" Guid="{068C1CF4-DA54-4221-B0D2-E7310770DF0B}" Directory="INSTALLFOLDER">
6 <Environment Id="WixEnvironmentTest1" Action="set" Name="WixEnvTest1"/>
7 <Environment Id="WixEnvironmentTest2" Action="create" Name="WixEnvTest1"/>
8 <Environment Id="WixEnvironmentTest3" Action="remove" Name="WixEnvTest1"/>
9 <Environment Id="WixEnvironmentTest4" Name="WIX" Action="set" System="yes" Value="[INSTALLFOLDER]" />
10 </Component>
11 </ComponentGroup>
12 </Fragment>
13</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 75a55c31..0330adf6 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -31,6 +31,7 @@
31 <Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 31 <Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
32 <Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 32 <Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
33 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 33 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
34 <Content Include="TestData\Environment\Environment.wxs" CopyToOutputDirectory="PreserveNewest" />
34 <Content Include="TestData\ErrorsInUI\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> 35 <Content Include="TestData\ErrorsInUI\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
35 <Content Include="TestData\ErrorsInUI\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 36 <Content Include="TestData\ErrorsInUI\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
36 <Content Include="TestData\ErrorsInUI\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 37 <Content Include="TestData\ErrorsInUI\Package.wxs" CopyToOutputDirectory="PreserveNewest" />