From a26c9ac0e9b02360b298ae5c619ca4070d11ae9a Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 3 Apr 2020 16:14:32 +1000 Subject: Add failing test for when EnsureTable references an extension table with a different name than its tuple. --- .../Example.Extension/ExampleTableDefinitions.cs | 5 ++-- .../ExampleWindowsInstallerBackendExtension.cs | 5 +++- .../MsiQueryFixture.cs | 34 ++++++++++++++++++++++ .../TestData/EnsureTable/EnsureTable.wxs | 10 +++++++ .../WixToolsetTest.CoreIntegration.csproj | 1 + 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/EnsureTable/EnsureTable.wxs (limited to 'src') 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 @@ -// 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. +// 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. namespace Example.Extension { @@ -7,7 +7,8 @@ namespace Example.Extension public static class ExampleTableDefinitions { public static readonly TableDefinition ExampleTable = new TableDefinition( - "Example", + "Wix4Example", + ExampleTupleDefinitions.Example.Name, new[] { 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 @@ -// 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. +// 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. namespace Example.Extension { + using System.Collections.Generic; using WixToolset.Data; using WixToolset.Data.WindowsInstaller; using WixToolset.Extensibility; internal class ExampleWindowsInstallerBackendExtension : BaseWindowsInstallerBackendBinderExtension { + public override IEnumerable TableDefinitions => ExampleTableDefinitions.All; + public override bool TryAddTupleToOutput(IntermediateTuple tuple, WindowsInstallerData output) { #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 @@ namespace WixToolsetTest.CoreIntegration { + using System; using System.IO; using System.Linq; + using Example.Extension; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using Xunit; @@ -526,6 +528,38 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void PopulatesExampleTableBecauseOfEnsureTable() + { + var folder = TestData.Get(@"TestData"); + var extensionPath = Path.GetFullPath(new Uri(typeof(ExampleExtensionFactory).Assembly.CodeBase).LocalPath); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "EnsureTable", "EnsureTable.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-ext", extensionPath, + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(msiPath)); + var results = Query.QueryDatabaseByTable(msiPath, new[] { "Wix4Example" }); + Assert.Empty(results["Wix4Example"]); + } + } + [Fact] public void PopulatesFeatureTableWithParent() { 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 @@ + + + + + + + + + + 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 @@ + -- cgit v1.2.3-55-g6feb