diff options
| author | Rob Mensching <rob@firegiant.com> | 2025-11-01 13:11:57 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2025-11-01 13:11:57 -0700 |
| commit | ad75882e4d822291113abff277ab8460cd0616e5 (patch) | |
| tree | c990c7644cf534c7dc791368d2287be6512cb51b | |
| parent | 897991b84edf788491f0bc55bd3e5c008390b1d3 (diff) | |
| download | wix-robmen/fixes.tar.gz wix-robmen/fixes.tar.bz2 wix-robmen/fixes.zip | |
Add a test for cabinets with no files in themrobmen/fixes
3 files changed, 45 insertions, 0 deletions
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiCabinetFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiCabinetFixture.cs index bc39e4d3..55f0ed55 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiCabinetFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiCabinetFixture.cs | |||
| @@ -252,5 +252,40 @@ namespace WixToolsetTest.CoreIntegration | |||
| 252 | WixAssert.CompareLineByLine(expectedMedia, mediaSymbols.Select(s => String.Join(" ", s.DiskId, s.Cabinet, s.LastSequence)).ToArray()); | 252 | WixAssert.CompareLineByLine(expectedMedia, mediaSymbols.Select(s => String.Join(" ", s.DiskId, s.Cabinet, s.LastSequence)).ToArray()); |
| 253 | } | 253 | } |
| 254 | } | 254 | } |
| 255 | |||
| 256 | [Fact] | ||
| 257 | public void CanBuildNoFilesCompressed() | ||
| 258 | { | ||
| 259 | var folder = TestData.Get(@"TestData", "NoFileCompressed"); | ||
| 260 | |||
| 261 | using (var fs = new DisposableFileSystem()) | ||
| 262 | { | ||
| 263 | var intermediateFolder = fs.GetFolder(); | ||
| 264 | |||
| 265 | var result = WixRunner.Execute( | ||
| 266 | [ | ||
| 267 | "build", | ||
| 268 | Path.Combine(folder, "Package.wxs"), | ||
| 269 | "-bindpath", Path.Combine(folder, "data"), | ||
| 270 | "-intermediateFolder", intermediateFolder, | ||
| 271 | "-o", Path.Combine(intermediateFolder, @"bin\test.msi") | ||
| 272 | ], out var messages, warningsAsErrors: false); | ||
| 273 | |||
| 274 | Assert.Equal(0, result); | ||
| 275 | WixAssert.CompareLineByLine( | ||
| 276 | [ | ||
| 277 | "1079 Warning - The cabinet 'example.cab' does not contain any files. If this installation contains no files, this warning can likely be safely ignored. Otherwise, please add files to the cabinet or remove it." | ||
| 278 | ], [.. messages.Select(m => $"{m.Id} {m.Level} - {m}")]); | ||
| 279 | |||
| 280 | Assert.True(File.Exists(Path.Combine(intermediateFolder, "bin", "test.msi"))); | ||
| 281 | Assert.True(File.Exists(Path.Combine(intermediateFolder, "bin", "example.cab"))); | ||
| 282 | Assert.True(File.Exists(Path.Combine(intermediateFolder, "bin", "test.wixpdb"))); | ||
| 283 | |||
| 284 | var intermediate = Intermediate.Load(Path.Combine(intermediateFolder, @"bin\test.wixpdb")); | ||
| 285 | var section = intermediate.Sections.Single(); | ||
| 286 | |||
| 287 | Assert.Empty(section.Symbols.OfType<FileSymbol>()); | ||
| 288 | } | ||
| 289 | } | ||
| 255 | } | 290 | } |
| 256 | } | 291 | } |
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/Package.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/Package.wxs new file mode 100644 index 00000000..0e4fbcf6 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/Package.wxs | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Package Id="WixTest.NoFiles" Name="MsiPackage" Language="1033" Version="0.0.1" Manufacturer="Example Corporation" Compressed="yes"> | ||
| 3 | <Media Id="1" Cabinet="example.cab" /> | ||
| 4 | |||
| 5 | <Component> | ||
| 6 | <RegistryValue Root="HKMU" Key="SOFTWARE\Wix Test" Name="Foo" Value="Bar" /> | ||
| 7 | </Component> | ||
| 8 | </Package> | ||
| 9 | </Wix> | ||
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/data/test.txt b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/NoFileCompressed/data/test.txt | |||
| @@ -0,0 +1 @@ | |||
| This is test.txt. \ No newline at end of file | |||
