From 2480d0ad4bf4f0dd841697d6d607bb35a0fd8161 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Sat, 23 May 2020 22:02:15 +1000 Subject: Add test for wixcop handling util:PermissionEx/@Inheritable. --- .../TestData/PermissionEx/v3.wxs | 27 +++++++++++++ .../TestData/PermissionEx/v4_expected.wxs | 27 +++++++++++++ src/test/WixToolsetTest.WixCop/WixCopFixture.cs | 45 ++++++++++++++++++++++ .../WixToolsetTest.WixCop.csproj | 6 ++- 4 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs create mode 100644 src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs (limited to 'src') diff --git a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs new file mode 100644 index 00000000..0e241544 --- /dev/null +++ b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v3.wxs @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs new file mode 100644 index 00000000..375b70d3 --- /dev/null +++ b/src/test/WixToolsetTest.WixCop/TestData/PermissionEx/v4_expected.wxs @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs b/src/test/WixToolsetTest.WixCop/WixCopFixture.cs index 207782b7..72a36dd6 100644 --- a/src/test/WixToolsetTest.WixCop/WixCopFixture.cs +++ b/src/test/WixToolsetTest.WixCop/WixCopFixture.cs @@ -9,6 +9,51 @@ namespace WixToolsetTest.WixCop public class WixCopFixture { + [Fact] + public void CanConvertPermissionExFile() + { + const string beforeFileName = "v3.wxs"; + const string afterFileName = "v4_expected.wxs"; + var folder = TestData.Get(@"TestData\PermissionEx"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(true); + var targetFile = Path.Combine(baseFolder, beforeFileName); + File.Copy(Path.Combine(folder, beforeFileName), Path.Combine(baseFolder, beforeFileName)); + + var runner = new WixCopRunner + { + FixErrors = true, + SearchPatterns = + { + targetFile, + }, + }; + + var result = runner.Execute(); + + Assert.Equal(2, result.ExitCode); + + var expected = File.ReadAllText(Path.Combine(folder, afterFileName)).Replace("\r\n", "\n"); + var actual = File.ReadAllText(targetFile).Replace("\r\n", "\n"); + Assert.Equal(expected, actual); + + var runner2 = new WixCopRunner + { + FixErrors = true, + SearchPatterns = + { + targetFile, + }, + }; + + var result2 = runner2.Execute(); + + Assert.Equal(0, result2.ExitCode); + } + } + [Fact] public void CanConvertSingleFile() { diff --git a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj index 787b8ca1..3ea4dae5 100644 --- a/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj +++ b/src/test/WixToolsetTest.WixCop/WixToolsetTest.WixCop.csproj @@ -18,8 +18,8 @@ - - + + @@ -27,6 +27,8 @@ + + -- cgit v1.2.3-55-g6feb