aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Arnson <bob@joyofsetup.com>2019-12-11 18:58:56 -0500
committerBob Arnson <bob@firegiant.com>2019-12-11 19:01:32 -0500
commit9ba9908cc585296f2b0ed2487351853e1a490005 (patch)
tree0cd1b641edafe5ffa381c4bbd0d50b38dd68607a /src
parentefcc52fdd0d767d45497ebf54765ad6da7878c6f (diff)
downloadwix-9ba9908cc585296f2b0ed2487351853e1a490005.tar.gz
wix-9ba9908cc585296f2b0ed2487351853e1a490005.tar.bz2
wix-9ba9908cc585296f2b0ed2487351853e1a490005.zip
Don't mess with CDATA whitespace.
Diffstat (limited to 'src')
-rw-r--r--src/WixToolset.Converters/Wix3Converter.cs2
-rw-r--r--src/test/WixToolsetTest.Converters/ConverterFixture.cs27
2 files changed, 26 insertions, 3 deletions
diff --git a/src/WixToolset.Converters/Wix3Converter.cs b/src/WixToolset.Converters/Wix3Converter.cs
index faff12ee..b6366a83 100644
--- a/src/WixToolset.Converters/Wix3Converter.cs
+++ b/src/WixToolset.Converters/Wix3Converter.cs
@@ -255,7 +255,7 @@ namespace WixToolset.Converters
255 255
256 private void EnsurePrecedingWhitespaceRemoved(XText whitespace, XNode node, ConverterTestType testType) 256 private void EnsurePrecedingWhitespaceRemoved(XText whitespace, XNode node, ConverterTestType testType)
257 { 257 {
258 if (!String.IsNullOrEmpty(whitespace.Value)) 258 if (!String.IsNullOrEmpty(whitespace.Value) && whitespace.NodeType != XmlNodeType.CDATA)
259 { 259 {
260 var message = testType == ConverterTestType.WhitespacePrecedingEndElementWrong ? "The whitespace preceding this end element is incorrect." : "The whitespace preceding this node is incorrect."; 260 var message = testType == ConverterTestType.WhitespacePrecedingEndElementWrong ? "The whitespace preceding this end element is incorrect." : "The whitespace preceding this node is incorrect.";
261 261
diff --git a/src/test/WixToolsetTest.Converters/ConverterFixture.cs b/src/test/WixToolsetTest.Converters/ConverterFixture.cs
index fd35ae50..cb70b35a 100644
--- a/src/test/WixToolsetTest.Converters/ConverterFixture.cs
+++ b/src/test/WixToolsetTest.Converters/ConverterFixture.cs
@@ -243,6 +243,25 @@ namespace WixToolsetTest.Converters
243 } 243 }
244 244
245 [Fact] 245 [Fact]
246 public void CanKeepCdataWithOnlyWhitespace()
247 {
248 var parse = String.Join(Environment.NewLine,
249 "<?xml version='1.0' encoding='utf-8'?>",
250 "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>",
251 " <Fragment>",
252 " <Property Id='Prop'><![CDATA[ ]]></Property>",
253 " </Fragment>",
254 "</Wix>");
255
256 var document = XDocument.Parse(parse, LoadOptions.PreserveWhitespace | LoadOptions.SetLineInfo);
257
258 var messaging = new DummyMessaging();
259 var converter = new Wix3Converter(messaging, 2, null, null);
260 var errors = converter.ConvertDocument(document);
261 Assert.Equal(0, errors);
262 }
263
264 [Fact]
246 public void CanConvertMainNamespace() 265 public void CanConvertMainNamespace()
247 { 266 {
248 var parse = String.Join(Environment.NewLine, 267 var parse = String.Join(Environment.NewLine,
@@ -400,7 +419,9 @@ namespace WixToolsetTest.Converters
400 "<Include>", 419 "<Include>",
401 " <?define Version = 1.2.3 ?>", 420 " <?define Version = 1.2.3 ?>",
402 " <Fragment>", 421 " <Fragment>",
403 " <DirectoryRef Id='TARGETDIR' />", 422 " <DirectoryRef Id='TARGETDIR'>",
423 " <Directory Id='ANOTHERDIR' Name='Another' />",
424 " </DirectoryRef>",
404 " </Fragment>", 425 " </Fragment>",
405 "</Include>"); 426 "</Include>");
406 427
@@ -409,7 +430,9 @@ namespace WixToolsetTest.Converters
409 "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">", 430 "<Include xmlns=\"http://wixtoolset.org/schemas/v4/wxs\">",
410 " <?define Version = 1.2.3 ?>", 431 " <?define Version = 1.2.3 ?>",
411 " <Fragment>", 432 " <Fragment>",
412 " <DirectoryRef Id=\"TARGETDIR\" />", 433 " <DirectoryRef Id=\"TARGETDIR\">",
434 " <Directory Id=\"ANOTHERDIR\" Name=\"Another\" />",
435 " </DirectoryRef>",
413 " </Fragment>", 436 " </Fragment>",
414 "</Include>"); 437 "</Include>");
415 438