diff options
author | Rob Mensching <rob@firegiant.com> | 2022-08-16 18:11:54 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2022-08-16 23:21:06 -0700 |
commit | 94e722baab4e848a615812a45fecc8322335d1f0 (patch) | |
tree | 8b1124ba75f3b1fc55981113660407c903d45543 /src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | |
parent | da5cc586114e537461b239a882c5bbea470d812d (diff) | |
download | wix-94e722baab4e848a615812a45fecc8322335d1f0.tar.gz wix-94e722baab4e848a615812a45fecc8322335d1f0.tar.bz2 wix-94e722baab4e848a615812a45fecc8322335d1f0.zip |
Update heat to use StandardDirectory element
Fixes 6631
Diffstat (limited to 'src/tools/test/WixToolsetTest.Heat/HeatFixture.cs')
-rw-r--r-- | src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs new file mode 100644 index 00000000..befcedcc --- /dev/null +++ b/src/tools/test/WixToolsetTest.Heat/HeatFixture.cs | |||
@@ -0,0 +1,136 @@ | |||
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.Heat | ||
4 | { | ||
5 | using System.IO; | ||
6 | using System.Linq; | ||
7 | using WixBuildTools.TestSupport; | ||
8 | using Xunit; | ||
9 | |||
10 | public class HeatFixture | ||
11 | { | ||
12 | [Fact] | ||
13 | public void CanHarvestSimpleDirectory() | ||
14 | { | ||
15 | var folder = TestData.Get("TestData", "SingleFile"); | ||
16 | |||
17 | using (var fs = new DisposableFileSystem()) | ||
18 | { | ||
19 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
20 | |||
21 | var args = new[] | ||
22 | { | ||
23 | "dir", folder, | ||
24 | "-o", outputPath | ||
25 | }; | ||
26 | |||
27 | var result = HeatRunner.Execute(args); | ||
28 | result.AssertSuccess(); | ||
29 | |||
30 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
31 | WixAssert.CompareLineByLine(new[] | ||
32 | { | ||
33 | "<?xml version='1.0' encoding='utf-8'?>", | ||
34 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
35 | " <Fragment>", | ||
36 | " <StandardDirectory Id='TARGETDIR'>", | ||
37 | " <Directory Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8' Name='SingleFile' />", | ||
38 | " </StandardDirectory>", | ||
39 | " </Fragment>", | ||
40 | " <Fragment>", | ||
41 | " <DirectoryRef Id='dirwsJn0Cqs9KdlDSFdQsu9ygYvMF8'>", | ||
42 | " <Component Id='cmp0i3dThrp4nheCteEmXvHxBDa_VE' Guid='PUT-GUID-HERE'>", | ||
43 | " <File Id='filziMcXYgrmcbVF8PuTUfIB9Vgqo0' KeyPath='yes' Source='SourceDir\\a.txt' />", | ||
44 | " </Component>", | ||
45 | " </DirectoryRef>", | ||
46 | " </Fragment>", | ||
47 | "</Wix>", | ||
48 | }, wxs); | ||
49 | } | ||
50 | } | ||
51 | |||
52 | [Fact] | ||
53 | public void CanHarvestSimpleDirectoryToInstallFolder() | ||
54 | { | ||
55 | var folder = TestData.Get("TestData", "SingleFile"); | ||
56 | |||
57 | using (var fs = new DisposableFileSystem()) | ||
58 | { | ||
59 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
60 | |||
61 | var args = new[] | ||
62 | { | ||
63 | "dir", folder, | ||
64 | "-dr", "INSTALLFOLDER", | ||
65 | "-o", outputPath | ||
66 | }; | ||
67 | |||
68 | var result = HeatRunner.Execute(args); | ||
69 | result.AssertSuccess(); | ||
70 | |||
71 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
72 | WixAssert.CompareLineByLine(new[] | ||
73 | { | ||
74 | "<?xml version='1.0' encoding='utf-8'?>", | ||
75 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
76 | " <Fragment>", | ||
77 | " <DirectoryRef Id='INSTALLFOLDER'>", | ||
78 | " <Directory Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE' Name='SingleFile' />", | ||
79 | " </DirectoryRef>", | ||
80 | " </Fragment>", | ||
81 | " <Fragment>", | ||
82 | " <DirectoryRef Id='dirlooNEIrtEBL2w_RhFEIgiKcUlxE'>", | ||
83 | " <Component Id='cmpxHVF6oXohc0EWgRphmYZvw5.GGU' Guid='PUT-GUID-HERE'>", | ||
84 | " <File Id='filk_7KUAfL4VfzxSRsGFf_XOBHln0' KeyPath='yes' Source='SourceDir\\a.txt' />", | ||
85 | " </Component>", | ||
86 | " </DirectoryRef>", | ||
87 | " </Fragment>", | ||
88 | "</Wix>", | ||
89 | }, wxs); | ||
90 | } | ||
91 | } | ||
92 | |||
93 | [Fact] | ||
94 | public void CanHarvestFile() | ||
95 | { | ||
96 | var folder = TestData.Get("TestData", "SingleFile"); | ||
97 | |||
98 | using (var fs = new DisposableFileSystem()) | ||
99 | { | ||
100 | var outputPath = Path.Combine(fs.GetFolder(), "out.wxs"); | ||
101 | |||
102 | var args = new[] | ||
103 | { | ||
104 | "file", Path.Combine(folder, "a.txt"), | ||
105 | "-cg", "GroupA", | ||
106 | "-dr", "ProgramFiles6432Folder", | ||
107 | "-o", outputPath | ||
108 | |||
109 | }; | ||
110 | |||
111 | var result = HeatRunner.Execute(args); | ||
112 | result.AssertSuccess(); | ||
113 | |||
114 | var wxs = File.ReadAllLines(outputPath).Select(s => s.Replace("\"", "'")).ToArray(); | ||
115 | WixAssert.CompareLineByLine(new[] | ||
116 | { | ||
117 | "<?xml version='1.0' encoding='utf-8'?>", | ||
118 | "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>", | ||
119 | " <Fragment>", | ||
120 | " <StandardDirectory Id='ProgramFiles6432Folder'>", | ||
121 | " <Directory Id='dirl6r_Yc0gvMUEUVe5rioOOIIasoU' Name='SingleFile' />", | ||
122 | " </StandardDirectory>", | ||
123 | " </Fragment>", | ||
124 | " <Fragment>", | ||
125 | " <ComponentGroup Id='GroupA'>", | ||
126 | " <Component Id='cmpfBcW61_XzosRWK3EzUTBtJrcJD8' Directory='dirl6r_Yc0gvMUEUVe5rioOOIIasoU' Guid='PUT-GUID-HERE'>", | ||
127 | " <File Id='filKrZgaIOSKpNZXFnezZc9X.LKGpw' KeyPath='yes' Source='SourceDir\\SingleFile\\a.txt' />", | ||
128 | " </Component>", | ||
129 | " </ComponentGroup>", | ||
130 | " </Fragment>", | ||
131 | "</Wix>", | ||
132 | }, wxs); | ||
133 | } | ||
134 | } | ||
135 | } | ||
136 | } | ||