From e34ea332def4718110e9a7efcf9e12bf7456c753 Mon Sep 17 00:00:00 2001
From: Sean Hall <r.sean.hall@gmail.com>
Date: Thu, 14 Nov 2019 12:13:44 +1000
Subject: Add failing test for decompiling a directory search under a registry
 search.

---
 .../DecompileFixture.cs                            |  28 +++++++++++++++++++++
 .../DecompiledNestedDirSearchUnderRegSearch.wxs    |  28 +++++++++++++++++++++
 .../AppSearch/NestedDirSearchUnderRegSearch.msi    | Bin 0 -> 36864 bytes
 .../WixToolsetTest.CoreIntegration.csproj          |   2 ++
 4 files changed, 58 insertions(+)
 create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs
 create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/NestedDirSearchUnderRegSearch.msi

(limited to 'src')

diff --git a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
index c2520896..c7c80f6e 100644
--- a/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
@@ -66,6 +66,34 @@ namespace WixToolsetTest.CoreIntegration
             }
         }
 
+        [Fact(Skip = "Test demonstrates failure")]
+        public void CanDecompileNestedDirSearchUnderRegSearch()
+        {
+            var folder = TestData.Get(@"TestData\AppSearch");
+
+            using (var fs = new DisposableFileSystem())
+            {
+                var intermediateFolder = fs.GetFolder();
+                var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
+
+                var result = WixRunner.Execute(new[]
+                {
+                    "decompile",
+                    Path.Combine(folder, "NestedDirSearchUnderRegSearch.msi"),
+                    "-intermediateFolder", intermediateFolder,
+                    "-o", outputPath
+                });
+
+                result.AssertSuccess();
+
+                var actual = File.ReadAllText(outputPath);
+                var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
+                var expected = XDocument.Load(Path.Combine(folder, "DecompiledNestedDirSearchUnderRegSearch.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
+
+                Assert.Equal(expected, actualFormatted);
+            }
+        }
+
         [Fact(Skip = "Test demonstrates failure")]
         public void CanDecompileOldClassTableDefinition()
         {
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs
new file mode 100644
index 00000000..94ddfe19
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/DecompiledNestedDirSearchUnderRegSearch.wxs
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
+  <Product Id="{F71CC1C8-8EDC-4FCD-8946-D92AE30B3ABE}" Codepage="1252" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{12E4699F-E774-4D05-8A01-5BDD41BBA127}" Version="1.0.0.0">
+    <Package Description="MsiPackage" InstallerVersion="500" Languages="1033" Manufacturer="Example Corporation" Platform="x86" />
+    <Directory Id="TARGETDIR" Name="SourceDir">
+      <Directory Id="ProgramFilesFolder">
+        <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="ykd0udtb">
+          <Component Id="test.txt" Guid="{E597A58A-03CB-50D8-93E3-DABA263F233A}" Win64="no">
+            <File Id="test.txt" Name="test.txt" KeyPath="yes" Source="SourceDir\\MsiPackage\test.txt" />
+          </Component>
+        </Directory>
+      </Directory>
+    </Directory>
+    <Feature Id="ProductFeature" Level="1" Title="MsiPackageTitle">
+      <ComponentRef Id="test.txt" />
+    </Feature>
+    <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
+    <Media Id="1" />
+    <Property Id="ALLUSERS" Value="1" />
+    <Property Id="SAMPLEDIRFOUND">
+      <RegistrySearch Id="SubRegSearch" Root="HKLM" Key="SampleReg" Type="raw">
+        <DirectorySearch Id="SampleDirSearch" Path="SampleDir">
+          <DirectorySearch Id="SubDirSearch" Path="Subdir" />
+        </DirectorySearch>
+      </RegistrySearch>
+    </Property>
+  </Product>
+</Wix>
\ No newline at end of file
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/NestedDirSearchUnderRegSearch.msi b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/NestedDirSearchUnderRegSearch.msi
new file mode 100644
index 00000000..7e0f8060
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/AppSearch/NestedDirSearchUnderRegSearch.msi differ
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 370f0ff5..75a55c31 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -16,8 +16,10 @@
     <Content Include="TestData\.Data\burn.exe" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\AppId\Advertised.wxs" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\AppSearch\ComponentSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
+    <Content Include="TestData\AppSearch\DecompiledNestedDirSearchUnderRegSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\AppSearch\DirectorySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\AppSearch\FileSearch.wxs" CopyToOutputDirectory="PreserveNewest" />
+    <Content Include="TestData\AppSearch\NestedDirSearchUnderRegSearch.msi" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\AppSearch\RegistrySearch.wxs" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\Class\DecompiledOldClassTableDef.wxs" CopyToOutputDirectory="PreserveNewest" />
     <Content Include="TestData\Class\IconIndex0.wxs" CopyToOutputDirectory="PreserveNewest" />
-- 
cgit v1.2.3-55-g6feb