aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-03-27 14:30:35 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-03-30 21:30:04 +1000
commitc455d2290ef903ff36d540903e27d76d473cb67c (patch)
treeb72ab75702810bc14e6f9bd31af3e1b67739f153 /src/test
parent0baf6e26ec7ab2ff0b6ad36e9d44f3d68819b5d6 (diff)
downloadwix-c455d2290ef903ff36d540903e27d76d473cb67c.tar.gz
wix-c455d2290ef903ff36d540903e27d76d473cb67c.tar.bz2
wix-c455d2290ef903ff36d540903e27d76d473cb67c.zip
Add SetVariable.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs44
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/SetVariable/Simple.wxs15
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj1
3 files changed, 60 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
index 80f7b875..174ac21b 100644
--- a/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/BundleManifestFixture.cs
@@ -113,5 +113,49 @@ namespace WixToolsetTest.CoreIntegration
113 "</BundleExtension>", bundleExtensionDatas[0].GetTestXml()); 113 "</BundleExtension>", bundleExtensionDatas[0].GetTestXml());
114 } 114 }
115 } 115 }
116
117 [Fact]
118 public void PopulatesManifestWithSetVariables()
119 {
120 var burnStubPath = TestData.Get(@"TestData\.Data\burn.exe");
121 var folder = TestData.Get(@"TestData");
122
123 using (var fs = new DisposableFileSystem())
124 {
125 var baseFolder = fs.GetFolder();
126 var intermediateFolder = Path.Combine(baseFolder, "obj");
127 var bundlePath = Path.Combine(baseFolder, @"bin\test.exe");
128 var baFolderPath = Path.Combine(baseFolder, "ba");
129 var extractFolderPath = Path.Combine(baseFolder, "extract");
130
131 var result = WixRunner.Execute(new[]
132 {
133 "build",
134 Path.Combine(folder, "SetVariable", "Simple.wxs"),
135 Path.Combine(folder, "BundleWithPackageGroupRef", "MinimalPackageGroup.wxs"),
136 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
137 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
138 "-intermediateFolder", intermediateFolder,
139 "-burnStub", burnStubPath,
140 "-o", bundlePath
141 });
142
143 result.AssertSuccess();
144
145 Assert.True(File.Exists(bundlePath));
146
147 var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
148 extractResult.AssertSuccess();
149
150 var setVariables = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:SetVariable");
151 Assert.Equal(6, setVariables.Count);
152 Assert.Equal("<SetVariable Id='SetCoercedNumber' Variable='CoercedNumber' Value='2' Type='numeric' />", setVariables[0].GetTestXml());
153 Assert.Equal("<SetVariable Id='SetCoercedString' Variable='CoercedString' Value='Bar' Type='string' />", setVariables[1].GetTestXml());
154 Assert.Equal("<SetVariable Id='SetCoercedVersion' Variable='CoercedVersion' Value='v2.0' Type='version' />", setVariables[2].GetTestXml());
155 Assert.Equal("<SetVariable Id='SetNeedsFormatting' Variable='NeedsFormatting' Value='[One] [Two] [Three]' Type='string' />", setVariables[3].GetTestXml());
156 Assert.Equal("<SetVariable Id='SetVersionString' Variable='VersionString' Value='v1.0' Type='string' />", setVariables[4].GetTestXml());
157 Assert.Equal("<SetVariable Id='SetUnset' Variable='Unset' Condition='VersionString = v2.0' />", setVariables[5].GetTestXml());
158 }
159 }
116 } 160 }
117} 161}
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/SetVariable/Simple.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/SetVariable/Simple.wxs
new file mode 100644
index 00000000..96c92e54
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/SetVariable/Simple.wxs
@@ -0,0 +1,15 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <PackageGroup Id="BundlePackages">
5 <PackageGroupRef Id="MinimalPackageGroup" />
6 </PackageGroup>
7
8 <SetVariable Id="SetCoercedNumber" Variable="CoercedNumber" Value="2" />
9 <SetVariable Id="SetCoercedString" Variable="CoercedString" Value="Bar" />
10 <SetVariable Id="SetCoercedVersion" Variable="CoercedVersion" Value="v2.0" />
11 <SetVariable Id="SetNeedsFormatting" Variable="NeedsFormatting" Value="[One] [Two] [Three]" />
12 <SetVariable Id="SetVersionString" Variable="VersionString" Value="v1.0" Type="string" />
13 <SetVariable Id="SetUnset" Variable="Unset" Condition="VersionString = v2.0" />
14 </Fragment>
15</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 324d04ff..921c77f9 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -112,6 +112,7 @@
112 <Content Include="TestData\SetProperty\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 112 <Content Include="TestData\SetProperty\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
113 <Content Include="TestData\SetProperty\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 113 <Content Include="TestData\SetProperty\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
114 <Content Include="TestData\SetProperty\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 114 <Content Include="TestData\SetProperty\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
115 <Content Include="TestData\SetVariable\Simple.wxs" CopyToOutputDirectory="PreserveNewest" />
115 <Content Include="TestData\SimpleBundle\data\test.msi" CopyToOutputDirectory="PreserveNewest" /> 116 <Content Include="TestData\SimpleBundle\data\test.msi" CopyToOutputDirectory="PreserveNewest" />
116 <Content Include="TestData\SimpleBundle\Bundle.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 117 <Content Include="TestData\SimpleBundle\Bundle.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
117 <Content Include="TestData\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> 118 <Content Include="TestData\SimpleBundle\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" />