From 84a26c3bf9d7a88a7dcbbca4d65b004307600ba2 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 4 Aug 2020 19:08:10 -0600 Subject: WIXFEAT:4763 Change "string" variable type to literal and add "formatted". --- .../WixToolsetTest.Converters/VariableFixture.cs | 86 ++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/test/WixToolsetTest.Converters/VariableFixture.cs (limited to 'src/test') diff --git a/src/test/WixToolsetTest.Converters/VariableFixture.cs b/src/test/WixToolsetTest.Converters/VariableFixture.cs new file mode 100644 index 00000000..b7b7388f --- /dev/null +++ b/src/test/WixToolsetTest.Converters/VariableFixture.cs @@ -0,0 +1,86 @@ +// 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 WixToolsetTest.Converters +{ + using System; + using System.Xml.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Converters; + using WixToolsetTest.Converters.Mocks; + using Xunit; + + public class VariableFixture : BaseConverterFixture + { + [Fact] + public void FixFormattedType() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + ""); + + var expected = new[] + { + "", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "" + }; + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + Assert.Equal(3, errors); + + var actualLines = UnformattedDocumentLines(document); + WixAssert.CompareLineByLine(expected, actualLines); + } + + [Fact] + public void DoesntFixFormattedTypeFromV4() + { + var parse = String.Join(Environment.NewLine, + "", + " ", + " ", + " ", + " ", + ""); + + var expected = new[] + { + "", + " ", + " ", + " ", + " ", + "" + }; + + var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); + + var messaging = new MockMessaging(); + var converter = new WixConverter(messaging, 2, null, null); + + var errors = converter.ConvertDocument(document); + Assert.Equal(0, errors); + + var actualLines = UnformattedDocumentLines(document); + WixAssert.CompareLineByLine(expected, actualLines); + } + } +} -- cgit v1.2.3-55-g6feb