diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-06 15:56:45 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-06 16:10:05 -0700 |
commit | f3a228eaf7d40bcd46b64c3d49aa23df23e79aec (patch) | |
tree | 759d4994003d0ad430e934ab97fa647c470fb396 /src/test | |
parent | 86e59fdbc94ae661ca682f04cddb60d7830ae8a8 (diff) | |
download | wix-f3a228eaf7d40bcd46b64c3d49aa23df23e79aec.tar.gz wix-f3a228eaf7d40bcd46b64c3d49aa23df23e79aec.tar.bz2 wix-f3a228eaf7d40bcd46b64c3d49aa23df23e79aec.zip |
Discards source directory name when identical to target name
Fixes wixtoolset/issues#6418
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs | 47 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs | 11 |
2 files changed, 58 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs index fe5bb531..e0b85509 100644 --- a/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.CoreIntegration | 3 | namespace WixToolsetTest.CoreIntegration |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.IO; | 6 | using System.IO; |
6 | using System.Linq; | 7 | using System.Linq; |
7 | using WixBuildTools.TestSupport; | 8 | using WixBuildTools.TestSupport; |
@@ -173,5 +174,51 @@ namespace WixToolsetTest.CoreIntegration | |||
173 | }, directoryRows.Select(r => r.FieldAsString(0) + ":" + r.FieldAsString(1) + ":" + r.FieldAsString(2)).ToArray()); | 174 | }, directoryRows.Select(r => r.FieldAsString(0) + ":" + r.FieldAsString(1) + ":" + r.FieldAsString(2)).ToArray()); |
174 | } | 175 | } |
175 | } | 176 | } |
177 | |||
178 | [Fact] | ||
179 | public void CanGetDuplicateTargetSourceName() | ||
180 | { | ||
181 | var folder = TestData.Get(@"TestData"); | ||
182 | |||
183 | using (var fs = new DisposableFileSystem()) | ||
184 | { | ||
185 | var baseFolder = fs.GetFolder(); | ||
186 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
187 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
188 | |||
189 | var result = WixRunner.Execute(new[] | ||
190 | { | ||
191 | "build", | ||
192 | "-arch", "x64", | ||
193 | Path.Combine(folder, "Directory", "DuplicateTargetSourceName.wxs"), | ||
194 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
195 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
196 | "-intermediateFolder", intermediateFolder, | ||
197 | "-o", msiPath | ||
198 | }); | ||
199 | |||
200 | result.AssertSuccess(); | ||
201 | |||
202 | var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
203 | var section = intermediate.Sections.Single(); | ||
204 | |||
205 | var dirSymbols = section.Symbols.OfType<WixToolset.Data.Symbols.DirectorySymbol>().ToList(); | ||
206 | Assert.Equal(new[] | ||
207 | { | ||
208 | "BinFolder\tProgramFilesFolder\tbin", | ||
209 | "ProgramFilesFolder\tTARGETDIR\tPFiles", | ||
210 | "TARGETDIR\t\tSourceDir" | ||
211 | }, dirSymbols.OrderBy(d => d.Id.Id).Select(d => String.Join('\t', d.Id.Id, d.ParentDirectoryRef, d.Name)).ToArray()); | ||
212 | |||
213 | var data = WindowsInstallerData.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); | ||
214 | var directoryRows = data.Tables["Directory"].Rows; | ||
215 | Assert.Equal(new[] | ||
216 | { | ||
217 | "BinFolder\tProgramFilesFolder\tbin", | ||
218 | "ProgramFilesFolder\tTARGETDIR\tPFiles", | ||
219 | "TARGETDIR\t\tSourceDir" | ||
220 | }, directoryRows.Select(r => String.Join('\t', r.FieldAsString(0), r.FieldAsString(1), r.FieldAsString(2))).ToArray()); | ||
221 | } | ||
222 | } | ||
176 | } | 223 | } |
177 | } | 224 | } |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs new file mode 100644 index 00000000..6e9a4495 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/DuplicateTargetSourceName.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Fragment> | ||
4 | <ComponentGroup Id="ProductComponents" Directory="BinFolder" /> | ||
5 | </Fragment> | ||
6 | <Fragment> | ||
7 | <StandardDirectory Id="ProgramFilesFolder"> | ||
8 | <Directory Id="BinFolder" Name="bin" SourceName="bin" /> | ||
9 | </StandardDirectory> | ||
10 | </Fragment> | ||
11 | </Wix> | ||