diff options
Diffstat (limited to 'src/test')
6 files changed, 80 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs index 9c60c902..ebc713ed 100644 --- a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs | |||
@@ -63,6 +63,32 @@ namespace WixToolsetTest.CoreIntegration | |||
63 | Assert.Equal(0, result); | 63 | Assert.Equal(0, result); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | |||
67 | [Fact] | ||
68 | public void NonterminatedPreprocessorInstructionShowsSourceLineNumber() | ||
69 | { | ||
70 | var folder = TestData.Get(@"TestData\BadIf"); | ||
71 | |||
72 | using (var fs = new DisposableFileSystem()) | ||
73 | { | ||
74 | var baseFolder = fs.GetFolder(); | ||
75 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
76 | |||
77 | var result = WixRunner.Execute(new[] | ||
78 | { | ||
79 | "build", | ||
80 | Path.Combine(folder, "Package.wxs"), | ||
81 | Path.Combine(folder, "PackageComponents.wxs"), | ||
82 | "-loc", Path.Combine(folder, "Package.en-us.wxl"), | ||
83 | "-bindpath", Path.Combine(folder, "data"), | ||
84 | "-intermediateFolder", intermediateFolder, | ||
85 | "-o", Path.Combine(baseFolder, @"bin\test.msi") | ||
86 | }, out var messages); | ||
87 | |||
88 | Assert.Equal(147, result); | ||
89 | Assert.StartsWith("Found a <?if?>", messages.Single().ToString()); | ||
90 | } | ||
91 | } | ||
66 | } | 92 | } |
67 | } | 93 | } |
68 | 94 | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.en-us.wxl b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.en-us.wxl new file mode 100644 index 00000000..38c12ac1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.en-us.wxl | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | |||
3 | <!-- | ||
4 | This file contains the declaration of all the localizable strings. | ||
5 | --> | ||
6 | <WixLocalization xmlns="http://wixtoolset.org/schemas/v4/wxl" Culture="en-US"> | ||
7 | |||
8 | <String Id="DowngradeError">A newer version of [ProductName] is already installed.</String> | ||
9 | <String Id="FeatureTitle">MsiPackage</String> | ||
10 | |||
11 | </WixLocalization> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.wxs new file mode 100644 index 00000000..73577ce5 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/Package.wxs | |||
@@ -0,0 +1,26 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <Product Id="*" Name="MsiPackage" Language="1033" Version="1.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a"> | ||
4 | <Package InstallerVersion="200" Compressed="no" InstallScope="perMachine" /> | ||
5 | |||
6 | <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeError)" /> | ||
7 | <MediaTemplate /> | ||
8 | |||
9 | <Feature Id="ProductFeature" Title="!(loc.FeatureTitle)"> | ||
10 | <ComponentGroupRef Id="ProductComponents.x86" /> | ||
11 | <!-- <?if x64 == $(sys.BUILDARCH) ?> --> | ||
12 | <!-- <?if arm==$(sys.BUILDARCH) ?> --> | ||
13 | <?if $(sys.BUILDARCH) = "x64" ?> | ||
14 | <ComponentGroupRef Id="ProductComponents.x64" /> | ||
15 | <ComponentGroupRef Id="ProductComponents.arm" /> | ||
16 | </Feature> | ||
17 | </Product> | ||
18 | |||
19 | <Fragment> | ||
20 | <Directory Id="TARGETDIR" Name="SourceDir"> | ||
21 | <Directory Id="ProgramFilesFolder"> | ||
22 | <Directory Id="INSTALLFOLDER" Name="MsiPackage" /> | ||
23 | </Directory> | ||
24 | </Directory> | ||
25 | </Fragment> | ||
26 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/PackageComponents.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/PackageComponents.wxs new file mode 100644 index 00000000..2a75e3d7 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/PackageComponents.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
3 | <?foreach ComponentPlatform in x86;x64;arm ?> | ||
4 | <Fragment> | ||
5 | <ComponentGroup Id="ProductComponents.$(var.ComponentPlatform)" Directory="INSTALLFOLDER"> | ||
6 | <Component> | ||
7 | <File Name="$(var.ComponentPlatform).dll" Source="test.txt" /> | ||
8 | </Component> | ||
9 | </ComponentGroup> | ||
10 | </Fragment> | ||
11 | <?endforeach?> | ||
12 | </Wix> | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/data/test.txt b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/data/test.txt new file mode 100644 index 00000000..cd0db0e1 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/BadIf/data/test.txt | |||
@@ -0,0 +1 @@ | |||
This is test.txt. \ No newline at end of file | |||
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 7c4578d9..38b7dc81 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj | |||
@@ -28,6 +28,10 @@ | |||
28 | <Content Include="TestData\ForEach\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 28 | <Content Include="TestData\ForEach\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
29 | <Content Include="TestData\ForEach\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 29 | <Content Include="TestData\ForEach\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |
30 | <Content Include="TestData\ForEach\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | 30 | <Content Include="TestData\ForEach\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> |
31 | <Content Include="TestData\BadIf\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> | ||
32 | <Content Include="TestData\BadIf\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | ||
33 | <Content Include="TestData\BadIf\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
34 | <Content Include="TestData\BadIf\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
31 | <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> | 35 | <Content Include="TestData\SingleFile\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> |
32 | <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> | 36 | <Content Include="TestData\SingleFile\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> |
33 | <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> | 37 | <Content Include="TestData\SingleFile\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> |