diff options
Diffstat (limited to 'src')
5 files changed, 50 insertions, 6 deletions
diff --git a/src/WixToolset.Core/Preprocessor.cs b/src/WixToolset.Core/Preprocessor.cs index b111b291..81b17578 100644 --- a/src/WixToolset.Core/Preprocessor.cs +++ b/src/WixToolset.Core/Preprocessor.cs | |||
| @@ -1351,7 +1351,7 @@ namespace WixToolset.Core | |||
| 1351 | 1351 | ||
| 1352 | if (state.Context.CurrentSourceLineNumber.LineNumber != newLine) | 1352 | if (state.Context.CurrentSourceLineNumber.LineNumber != newLine) |
| 1353 | { | 1353 | { |
| 1354 | state.Context.CurrentSourceLineNumber = new SourceLineNumber(state.Context.CurrentSourceLineNumber.FileName, newLine); | 1354 | state.Context.CurrentSourceLineNumber = new SourceLineNumber(state.Context.CurrentSourceLineNumber.FileName, state.Context.CurrentSourceLineNumber.Parent, newLine); |
| 1355 | } | 1355 | } |
| 1356 | } | 1356 | } |
| 1357 | } | 1357 | } |
| @@ -1372,7 +1372,7 @@ namespace WixToolset.Core | |||
| 1372 | 1372 | ||
| 1373 | state.CurrentFileStack.Push(path); | 1373 | state.CurrentFileStack.Push(path); |
| 1374 | state.SourceStack.Push(state.Context.CurrentSourceLineNumber); | 1374 | state.SourceStack.Push(state.Context.CurrentSourceLineNumber); |
| 1375 | state.Context.CurrentSourceLineNumber = new SourceLineNumber(path); | 1375 | state.Context.CurrentSourceLineNumber = new SourceLineNumber(path, state.Context.CurrentSourceLineNumber); |
| 1376 | state.IncludeNextStack.Push(true); | 1376 | state.IncludeNextStack.Push(true); |
| 1377 | } | 1377 | } |
| 1378 | 1378 | ||
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> | ||
