aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-03 16:14:32 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-03 20:46:59 +1000
commita26c9ac0e9b02360b298ae5c619ca4070d11ae9a (patch)
treecaa1361272a8ff67f1c38ac37f8256ab7d967072 /src
parent11112ebcdf97d4fa53e34d9dfe48410ff2378435 (diff)
downloadwix-a26c9ac0e9b02360b298ae5c619ca4070d11ae9a.tar.gz
wix-a26c9ac0e9b02360b298ae5c619ca4070d11ae9a.tar.bz2
wix-a26c9ac0e9b02360b298ae5c619ca4070d11ae9a.zip
Add failing test for when EnsureTable references an extension table with a different name than its tuple.
Diffstat (limited to 'src')
-rw-r--r--src/test/Example.Extension/ExampleTableDefinitions.cs5
-rw-r--r--src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs5
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs34
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs10
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj1
5 files changed, 52 insertions, 3 deletions
diff --git a/src/test/Example.Extension/ExampleTableDefinitions.cs b/src/test/Example.Extension/ExampleTableDefinitions.cs
index dbd6491b..5dbf6d64 100644
--- a/src/test/Example.Extension/ExampleTableDefinitions.cs
+++ b/src/test/Example.Extension/ExampleTableDefinitions.cs
@@ -1,4 +1,4 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3namespace Example.Extension 3namespace Example.Extension
4{ 4{
@@ -7,7 +7,8 @@ namespace Example.Extension
7 public static class ExampleTableDefinitions 7 public static class ExampleTableDefinitions
8 { 8 {
9 public static readonly TableDefinition ExampleTable = new TableDefinition( 9 public static readonly TableDefinition ExampleTable = new TableDefinition(
10 "Example", 10 "Wix4Example",
11 ExampleTupleDefinitions.Example.Name,
11 new[] 12 new[]
12 { 13 {
13 new ColumnDefinition("Example", ColumnType.String, 72, true, false, ColumnCategory.Identifier), 14 new ColumnDefinition("Example", ColumnType.String, 72, true, false, ColumnCategory.Identifier),
diff --git a/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
index d6741bc1..af9c8489 100644
--- a/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
+++ b/src/test/Example.Extension/ExampleWindowsInstallerBackendExtension.cs
@@ -1,13 +1,16 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. 1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2 2
3namespace Example.Extension 3namespace Example.Extension
4{ 4{
5 using System.Collections.Generic;
5 using WixToolset.Data; 6 using WixToolset.Data;
6 using WixToolset.Data.WindowsInstaller; 7 using WixToolset.Data.WindowsInstaller;
7 using WixToolset.Extensibility; 8 using WixToolset.Extensibility;
8 9
9 internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendBinderExtension 10 internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendBinderExtension
10 { 11 {
12 public override IEnumerable<TableDefinition> TableDefinitions => ExampleTableDefinitions.All;
13
11 public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output) 14 public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output)
12 { 15 {
13#if ALTERNATIVE_TO_USING_HELPER 16#if ALTERNATIVE_TO_USING_HELPER
diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
index d93b3d54..0010f3f2 100644
--- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs
@@ -2,8 +2,10 @@
2 2
3namespace WixToolsetTest.CoreIntegration 3namespace WixToolsetTest.CoreIntegration
4{ 4{
5 using System;
5 using System.IO; 6 using System.IO;
6 using System.Linq; 7 using System.Linq;
8 using Example.Extension;
7 using WixBuildTools.TestSupport; 9 using WixBuildTools.TestSupport;
8 using WixToolset.Core.TestPackage; 10 using WixToolset.Core.TestPackage;
9 using Xunit; 11 using Xunit;
@@ -527,6 +529,38 @@ namespace WixToolsetTest.CoreIntegration
527 } 529 }
528 530
529 [Fact] 531 [Fact]
532 public void PopulatesExampleTableBecauseOfEnsureTable()
533 {
534 var folder = TestData.Get(@"TestData");
535 var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath);
536
537 using (var fs = new DisposableFileSystem())
538 {
539 var baseFolder = fs.GetFolder();
540 var intermediateFolder = Path.Combine(baseFolder, "obj");
541 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
542
543 var result = WixRunner.Execute(new[]
544 {
545 "build",
546 Path.Combine(folder, "EnsureTable", "EnsureTable.wxs"),
547 Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
548 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
549 "-ext", extensionPath,
550 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
551 "-intermediateFolder", intermediateFolder,
552 "-o", msiPath
553 });
554
555 result.AssertSuccess();
556
557 Assert.True(File.Exists(msiPath));
558 var results = Query.QueryDatabaseByTable(msiPath, new[] { "Wix4Example" });
559 Assert.Empty(results["Wix4Example"]);
560 }
561 }
562
563 [Fact]
530 public void PopulatesFeatureTableWithParent() 564 public void PopulatesFeatureTableWithParent()
531 { 565 {
532 var folder = TestData.Get(@"TestData"); 566 var folder = TestData.Get(@"TestData");
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs
new file mode 100644
index 00000000..01767abb
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents">
5 <ComponentGroupRef Id="MinimalComponentGroup" />
6 </ComponentGroup>
7
8 <EnsureTable Id="Wix4Example" />
9 </Fragment>
10</Wix>
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
index 921c77f9..98402223 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
+++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj
@@ -37,6 +37,7 @@
37 <Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 37 <Content Include="TestData\DialogsInInstallUISequence\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />
38 <Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" /> 38 <Content Include="TestData\DialogsInInstallUISequence\Package.wxs" CopyToOutputDirectory="PreserveNewest" />
39 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" /> 39 <Content Include="TestData\DialogsInInstallUISequence\PackageComponents.wxs" CopyToOutputDirectory="PreserveNewest" />
40 <Content Include="TestData\EnsureTable\EnsureTable.wxs" CopyToOutputDirectory="PreserveNewest" />
40 <Content Include="TestData\Environment\Environment.wxs" CopyToOutputDirectory="PreserveNewest" /> 41 <Content Include="TestData\Environment\Environment.wxs" CopyToOutputDirectory="PreserveNewest" />
41 <Content Include="TestData\ErrorsInUI\data\test.txt" CopyToOutputDirectory="PreserveNewest" /> 42 <Content Include="TestData\ErrorsInUI\data\test.txt" CopyToOutputDirectory="PreserveNewest" />
42 <Content Include="TestData\ErrorsInUI\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" /> 43 <Content Include="TestData\ErrorsInUI\Package.en-us.wxl" CopyToOutputDirectory="PreserveNewest" />