diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-03-01 23:34:57 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-03-02 02:21:22 -0800 |
| commit | 7eab295351796e2b41c1805d027957e1a7d9ddc6 (patch) | |
| tree | e7c808ac19909fd9c14989d2ff3040ede2e5fe3d /src/test/WixToolsetTest.CoreIntegration | |
| parent | 3eb3c26c796984b64365fda077f173af8bf31559 (diff) | |
| download | wix-7eab295351796e2b41c1805d027957e1a7d9ddc6.tar.gz wix-7eab295351796e2b41c1805d027957e1a7d9ddc6.tar.bz2 wix-7eab295351796e2b41c1805d027957e1a7d9ddc6.zip | |
Correctly set the parent SourceLineNumber for include files
Diffstat (limited to 'src/test/WixToolsetTest.CoreIntegration')
4 files changed, 48 insertions, 4 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs index aad3ed73..89057991 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | |||
| @@ -8,6 +8,7 @@ namespace WixToolsetTest.CoreIntegration | |||
| 8 | using WixToolset.Core; | 8 | using WixToolset.Core; |
| 9 | using WixToolset.Core.TestPackage; | 9 | using WixToolset.Core.TestPackage; |
| 10 | using WixToolset.Data; | 10 | using WixToolset.Data; |
| 11 | using WixToolset.Data.Symbols; | ||
| 11 | using WixToolset.Extensibility.Data; | 12 | using WixToolset.Extensibility.Data; |
| 12 | using Xunit; | 13 | using Xunit; |
| 13 | 14 | ||
| @@ -40,6 +41,45 @@ namespace WixToolsetTest.CoreIntegration | |||
| 40 | } | 41 | } |
| 41 | 42 | ||
| 42 | [Fact] | 43 | [Fact] |
| 44 | public void IncludeSourceLineNumbersPreserved() | ||
| 45 | { | ||
| 46 | var folder = TestData.Get(@"TestData\IncludePath"); | ||
| 47 | |||
| 48 | using (var fs = new DisposableFileSystem()) | ||
| 49 | { | ||
| 50 | var baseFolder = fs.GetFolder(); | ||
| 51 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 52 | |||
| 53 | var result = WixRunner.Execute(warningsAsErrors: false, new[] | ||
| 54 | { | ||
| 55 | "build", | ||
| 56 | Path.Combine(folder, "Package.wxs"), | ||
| 57 | Path.Combine(folder, "PackageComponents.wxs"), | ||
| 58 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
| 59 | "-includepath", Path.Combine(folder, "data"), | ||
| 60 | "-bindpath", Path.Combine(folder, "data"), | ||
| 61 | "-intermediateFolder", intermediateFolder, | ||
| 62 | "-o", Path.Combine(baseFolder, @"bin\test.msi") | ||
| 63 | }); | ||
| 64 | |||
| 65 | result.AssertSuccess(); | ||
| 66 | |||
| 67 | using (var output = WixOutput.Read(Path.Combine(baseFolder, @"bin\test.wixpdb"))) | ||
| 68 | { | ||
| 69 | var intermediate = Intermediate.Load(output); | ||
| 70 | var component = intermediate.Sections.Single().Symbols.OfType<ComponentSymbol>().Single(); | ||
| 71 | Assert.Equal(3, component.SourceLineNumbers.LineNumber); | ||
| 72 | Assert.Equal(5, component.SourceLineNumbers.Parent.LineNumber); | ||
| 73 | |||
| 74 | var encoded = component.SourceLineNumbers.GetEncoded(); | ||
| 75 | var decoded = SourceLineNumber.CreateFromEncoded(encoded); | ||
| 76 | Assert.Equal(3, decoded.LineNumber); | ||
| 77 | Assert.Equal(5, decoded.Parent.LineNumber); | ||
| 78 | } | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | [Fact] | ||
| 43 | /// <remarks> | 83 | /// <remarks> |
| 44 | /// This test will fail on 32-bit operating systems because it depends on "CommonProgramFiles(x86)" | 84 | /// This test will fail on 32-bit operating systems because it depends on "CommonProgramFiles(x86)" |
| 45 | /// which is only defined on 64-bit Windows. | 85 | /// which is only defined on 64-bit Windows. |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs index 6269fe9d..48a38e85 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/Package.wxs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | <?include Package.wxi ?> | 1 | <?include Package.wxi ?> |
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
| 3 | <Package Name="MsiPackage" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" Compressed="no" InstallerVersion="200" Scope="perMachine"> | 3 | <Package Name="MsiPackage" Language="1033" Version="$(var.ProductVersion)" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a" Compressed="no" InstallerVersion="200" Scope="perMachine"> |
| 4 | 4 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs index e26c4509..7a0485ed 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/PackageComponents.wxs | |||
| @@ -2,9 +2,7 @@ | |||
| 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
| 3 | <Fragment> | 3 | <Fragment> |
| 4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> | 4 | <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> |
| 5 | <Component> | 5 | <?include DontDoThis.wxi ?> |
| 6 | <File Source="test.txt" /> | ||
| 7 | </Component> | ||
| 8 | </ComponentGroup> | 6 | </ComponentGroup> |
| 9 | </Fragment> | 7 | </Fragment> |
| 10 | </Wix> | 8 | </Wix> |
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/DontDoThis.wxi b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/DontDoThis.wxi new file mode 100644 index 00000000..03885e3e --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/IncludePath/data/DontDoThis.wxi | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <Include xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 3 | <Component> | ||
| 4 | <File Source="test.txt" /> | ||
| 5 | </Component> | ||
| 6 | </Include> | ||
