diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2020-08-04 19:08:10 -0600 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2020-08-09 10:39:59 -0600 |
| commit | 84a26c3bf9d7a88a7dcbbca4d65b004307600ba2 (patch) | |
| tree | 064151cdb51794e1ce97e47a6e8ddd4bb63ec59d /src/test | |
| parent | 50be148eff5ab3081498c9bb91772abc19741e40 (diff) | |
| download | wix-84a26c3bf9d7a88a7dcbbca4d65b004307600ba2.tar.gz wix-84a26c3bf9d7a88a7dcbbca4d65b004307600ba2.tar.bz2 wix-84a26c3bf9d7a88a7dcbbca4d65b004307600ba2.zip | |
WIXFEAT:4763 Change "string" variable type to literal and add "formatted".
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/WixToolsetTest.Converters/VariableFixture.cs | 86 |
1 files changed, 86 insertions, 0 deletions
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 @@ | |||
| 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 | |||
| 3 | namespace WixToolsetTest.Converters | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.Xml.Linq; | ||
| 7 | using WixBuildTools.TestSupport; | ||
| 8 | using WixToolset.Converters; | ||
| 9 | using WixToolsetTest.Converters.Mocks; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class VariableFixture : BaseConverterFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void FixFormattedType() | ||
| 16 | { | ||
| 17 | var parse = String.Join(Environment.NewLine, | ||
| 18 | "<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>", | ||
| 19 | " <Fragment>", | ||
| 20 | " <Variable Name='ExplicitString' Type='string' Value='explicit' />", | ||
| 21 | " <Variable Name='ImplicitNumber' Value='42' />", | ||
| 22 | " <Variable Name='ImplicitString' Value='implicit' />", | ||
| 23 | " <Variable Name='ImplicitVersion' Value='v2' />", | ||
| 24 | " <Variable Name='NoTypeOrValue' />", | ||
| 25 | " </Fragment>", | ||
| 26 | "</Wix>"); | ||
| 27 | |||
| 28 | var expected = new[] | ||
| 29 | { | ||
| 30 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 31 | " <Fragment>", | ||
| 32 | " <Variable Name=\"ExplicitString\" Type=\"formatted\" Value=\"explicit\" />", | ||
| 33 | " <Variable Name=\"ImplicitNumber\" Value=\"42\" />", | ||
| 34 | " <Variable Name=\"ImplicitString\" Value=\"implicit\" Type=\"formatted\" />", | ||
| 35 | " <Variable Name=\"ImplicitVersion\" Value=\"v2\" />", | ||
| 36 | " <Variable Name=\"NoTypeOrValue\" />", | ||
| 37 | " </Fragment>", | ||
| 38 | "</Wix>" | ||
| 39 | }; | ||
| 40 | |||
| 41 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 42 | |||
| 43 | var messaging = new MockMessaging(); | ||
| 44 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 45 | |||
| 46 | var errors = converter.ConvertDocument(document); | ||
| 47 | Assert.Equal(3, errors); | ||
| 48 | |||
| 49 | var actualLines = UnformattedDocumentLines(document); | ||
| 50 | WixAssert.CompareLineByLine(expected, actualLines); | ||
| 51 | } | ||
| 52 | |||
| 53 | [Fact] | ||
| 54 | public void DoesntFixFormattedTypeFromV4() | ||
| 55 | { | ||
| 56 | var parse = String.Join(Environment.NewLine, | ||
| 57 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
| 58 | " <Fragment>", | ||
| 59 | " <Variable Name='ImplicitString' Value='implicit' />", | ||
| 60 | " <Variable Name='ExplicitString' Type='string' Value='explicit' />", | ||
| 61 | " </Fragment>", | ||
| 62 | "</Wix>"); | ||
| 63 | |||
| 64 | var expected = new[] | ||
| 65 | { | ||
| 66 | "<Wix xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", | ||
| 67 | " <Fragment>", | ||
| 68 | " <Variable Name=\"ImplicitString\" Value=\"implicit\" />", | ||
| 69 | " <Variable Name=\"ExplicitString\" Type=\"string\" Value=\"explicit\" />", | ||
| 70 | " </Fragment>", | ||
| 71 | "</Wix>" | ||
| 72 | }; | ||
| 73 | |||
| 74 | var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo); | ||
| 75 | |||
| 76 | var messaging = new MockMessaging(); | ||
| 77 | var converter = new WixConverter(messaging, 2, null, null); | ||
| 78 | |||
| 79 | var errors = converter.ConvertDocument(document); | ||
| 80 | Assert.Equal(0, errors); | ||
| 81 | |||
| 82 | var actualLines = UnformattedDocumentLines(document); | ||
| 83 | WixAssert.CompareLineByLine(expected, actualLines); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | } | ||
