Add failing test for decompiling a non-advertised shortcut with complex Target.
Sean Hall committed
Nov 8, 2019 at 13:37 UTC
e03595bdca426a03ad740e4c312f028f97f465ec
4 files changed
+54
src/test/WixToolsetTest.CoreIntegration/DecompileFixture.cs
+28
@@ -96,5 +96,33 @@ namespace WixToolsetTest.CoreIntegration
96
Assert.Equal(expected, actualFormatted);
97
}
98
}
99
+
100
+ [Fact(Skip = "Test demonstrates failure")]
101
+ public void CanDecompileShortcuts()
102
+ {
103
+ var folder = TestData.Get(@"TestData\Shortcut");
104
+
105
+ using (var fs = new DisposableFileSystem())
106
+ {
107
+ var intermediateFolder = fs.GetFolder();
108
+ var outputPath = Path.Combine(intermediateFolder, @"Actual.wxs");
109
+
110
+ var result = WixRunner.Execute(new[]
111
+ {
112
+ "decompile",
113
+ Path.Combine(folder, "shortcuts.msi"),
114
+ "-intermediateFolder", intermediateFolder,
115
+ "-o", outputPath
116
+ });
117
+
118
+ result.AssertSuccess();
119
+
120
+ var actual = File.ReadAllText(outputPath);
121
+ var actualFormatted = XDocument.Parse(actual, LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
122
+ var expected = XDocument.Load(Path.Combine(folder, "DecompiledShortcuts.wxs"), LoadOptions.PreserveWhitespace | LoadOptions.SetBaseUri | LoadOptions.SetLineInfo).ToString();
123
+
124
+ Assert.Equal(expected, actualFormatted);
125
+ }
126
+ }
127
}
128
}
src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/DecompiledShortcuts.wxs
new
+24
@@ -0,0 +1,24 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3
+ <Product Id="{6CA94D1D-B568-4ED6-9EBC-3534C85970BB}" Codepage="1252" Language="1033" Manufacturer="Example Corporation" Name="MsiPackage" UpgradeCode="{12E4699F-E774-4D05-8A01-5BDD41BBA127}" Version="1.0.0.0">
4
+ <Package Description="MsiPackage" InstallerVersion="500" Languages="1033" Manufacturer="Example Corporation" Platform="x86" />
5
+ <Directory Id="TARGETDIR" Name="SourceDir">
6
+ <Directory Id="ProgramFilesFolder">
7
+ <Directory Id="INSTALLFOLDER" Name="MsiPackage" ShortName="ykd0udtb">
8
+ <Component Id="ShortcutComp" Guid="{5B3B3FC1-533D-4C29-BFB3-0E88B51E59D8}" Win64="no">
9
+ <File Id="test.txt" Name="test.txt" KeyPath="yes" Source="SourceDir\\MsiPackage\test.txt" />
10
+ <Shortcut Id="FileTargetShortcut" Directory="INSTALLFOLDER" Name="FileTargetShortcut" ShortName="lm2tdtqp" Target="[#test.txt]" />
11
+ <Shortcut Id="CustomTargetShortcut" Directory="INSTALLFOLDER" Name="CustomTargetShortcut" ShortName="treusbt_" Target="[INSTALLFOLDER]custom.target" />
12
+ <Shortcut Id="AdvtShortcut" Directory="INSTALLFOLDER" Name="AdvtShortcut" ShortName="mdbqel9r" Advertise="yes" />
13
+ </Component>
14
+ </Directory>
15
+ </Directory>
16
+ </Directory>
17
+ <Feature Id="ProductFeature" Level="1" Title="MsiPackageTitle">
18
+ <ComponentRef Id="ShortcutComp" Primary="yes" />
19
+ </Feature>
20
+ <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
21
+ <Media Id="1" />
22
+ <Property Id="ALLUSERS" Value="1" />
23
+ </Product>
24
+</Wix>
\ No newline at end of file
src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi
Binary files /dev/null and b/src/test/WixToolsetTest.CoreIntegration/TestData/Shortcut/shortcuts.msi differ
src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+2
@@ -48,7 +48,9 @@
48
<Content Include="TestData\Registry\RemoveRegistryKey.wxs" CopyToOutputDirectory="PreserveNewest" />
49
<Content Include="TestData\ReserveCost\ReserveCost.wxs" CopyToOutputDirectory="PreserveNewest" />
50
<Content Include="TestData\ServiceInstall\OwnProcess.wxs" CopyToOutputDirectory="PreserveNewest" />
51
+ <Content Include="TestData\Shortcut\DecompiledShortcuts.wxs" CopyToOutputDirectory="PreserveNewest" />
52
<Content Include="TestData\Shortcut\ShortcutProperty.wxs" CopyToOutputDirectory="PreserveNewest" />
53
+ <Content Include="TestData\Shortcut\shortcuts.msi" CopyToOutputDirectory="PreserveNewest" />
54
<Content Include="TestData\SimpleBundle\data\fakeba.dll" CopyToOutputDirectory="PreserveNewest" />
55
<Content Include="TestData\SimpleBundle\data\MsiPackage\Shared.dll" CopyToOutputDirectory="PreserveNewest" />
56
<Content Include="TestData\SimpleBundle\data\MsiPackage\test.txt" CopyToOutputDirectory="PreserveNewest" />