aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-02 18:38:55 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-02 21:34:24 +1000
commit302b501f9ed2ae840ce598b30792d0fc1b538572 (patch)
treec476955f346c34e0c22c5712d4a1ec9f75499528
parentbf435c69fd70f5140eddd99fe02d3dcdae75473a (diff)
downloadwix-302b501f9ed2ae840ce598b30792d0fc1b538572.tar.gz
wix-302b501f9ed2ae840ce598b30792d0fc1b538572.tar.bz2
wix-302b501f9ed2ae840ce598b30792d0fc1b538572.zip
Fix bug in ParseHelper where it assumed the first column was the id column.
-rw-r--r--src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs18
-rw-r--r--src/test/Example.Extension/ExampleCompilerExtension.cs3
-rw-r--r--src/test/Example.Extension/ExampleSearchTuple.cs1
-rw-r--r--src/test/Example.Extension/ExampleTupleDefinitions.cs1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs2
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs4
6 files changed, 6 insertions, 23 deletions
diff --git a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
index 2a851a21..ed529dbb 100644
--- a/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
+++ b/src/WixToolset.Core/ExtensibilityServices/ParseHelper.cs
@@ -981,23 +981,7 @@ namespace WixToolset.Core.ExtensibilityServices
981 981
982 private static IntermediateTuple CreateTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, Identifier identifier) 982 private static IntermediateTuple CreateTuple(IntermediateSection section, SourceLineNumber sourceLineNumbers, IntermediateTupleDefinition tupleDefinition, Identifier identifier)
983 { 983 {
984 var tuple = tupleDefinition.CreateTuple(sourceLineNumbers, identifier); 984 return section.AddTuple(tupleDefinition.CreateTuple(sourceLineNumbers, identifier));
985
986 if (null != identifier)
987 {
988 if (tuple.Definition.FieldDefinitions[0].Type == IntermediateFieldType.Number)
989 {
990 tuple.Set(0, Convert.ToInt32(identifier.Id));
991 }
992 else
993 {
994 tuple.Set(0, identifier.Id);
995 }
996 }
997
998 section.Tuples.Add(tuple);
999
1000 return tuple;
1001 } 985 }
1002 986
1003 private static bool TryFindExtension(IEnumerable<ICompilerExtension> extensions, XNamespace ns, out ICompilerExtension extension) 987 private static bool TryFindExtension(IEnumerable<ICompilerExtension> extensions, XNamespace ns, out ICompilerExtension extension)
diff --git a/src/test/Example.Extension/ExampleCompilerExtension.cs b/src/test/Example.Extension/ExampleCompilerExtension.cs
index 543b4165..52168adc 100644
--- a/src/test/Example.Extension/ExampleCompilerExtension.cs
+++ b/src/test/Example.Extension/ExampleCompilerExtension.cs
@@ -88,7 +88,8 @@ namespace Example.Extension
88 88
89 if (!this.Messaging.EncounteredError) 89 if (!this.Messaging.EncounteredError)
90 { 90 {
91 var tuple = this.ParseHelper.CreateTuple(section, sourceLineNumbers, "Example", id); 91 var tuple = this.ParseHelper.CreateTuple(section, sourceLineNumbers, "Example");
92 tuple.Set(0, id.Id);
92 tuple.Set(1, value); 93 tuple.Set(1, value);
93 } 94 }
94 } 95 }
diff --git a/src/test/Example.Extension/ExampleSearchTuple.cs b/src/test/Example.Extension/ExampleSearchTuple.cs
index df34f0af..353ef158 100644
--- a/src/test/Example.Extension/ExampleSearchTuple.cs
+++ b/src/test/Example.Extension/ExampleSearchTuple.cs
@@ -6,7 +6,6 @@ namespace Example.Extension
6 6
7 public enum ExampleSearchTupleFields 7 public enum ExampleSearchTupleFields
8 { 8 {
9 Example,
10 SearchFor, 9 SearchFor,
11 } 10 }
12 11
diff --git a/src/test/Example.Extension/ExampleTupleDefinitions.cs b/src/test/Example.Extension/ExampleTupleDefinitions.cs
index b2c8c484..a9771509 100644
--- a/src/test/Example.Extension/ExampleTupleDefinitions.cs
+++ b/src/test/Example.Extension/ExampleTupleDefinitions.cs
@@ -22,7 +22,6 @@ namespace Example.Extension
22 nameof(ExampleSearch), 22 nameof(ExampleSearch),
23 new[] 23 new[]
24 { 24 {
25 new IntermediateFieldDefinition(nameof(ExampleTupleFields.Example), IntermediateFieldType.String),
26 new IntermediateFieldDefinition(nameof(ExampleSearchTupleFields.SearchFor), IntermediateFieldType.String), 25 new IntermediateFieldDefinition(nameof(ExampleSearchTupleFields.SearchFor), IntermediateFieldType.String),
27 }, 26 },
28 typeof(ExampleSearchTuple)); 27 typeof(ExampleSearchTuple));
diff --git a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
index 4bc5b535..b75e8ad9 100644
--- a/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/ExtensionFixture.cs
@@ -63,7 +63,7 @@ namespace WixToolsetTest.CoreIntegration
63 Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); 63 Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path);
64 64
65 var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); 65 var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single();
66 Assert.Equal("Foo", example.Id.Id); 66 Assert.Null(example.Id?.Id);
67 Assert.Equal("Foo", example[0].AsString()); 67 Assert.Equal("Foo", example[0].AsString());
68 Assert.Equal("Bar", example[1].AsString()); 68 Assert.Equal("Bar", example[1].AsString());
69 } 69 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
index 5f8a278e..c7af6439 100644
--- a/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/WixlibFixture.cs
@@ -168,7 +168,7 @@ namespace WixToolsetTest.CoreIntegration
168 Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path); 168 Assert.Equal(@"example.txt", fileTuple[FileTupleFields.Source].PreviousValue.AsPath().Path);
169 169
170 var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single(); 170 var example = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).Single();
171 Assert.Equal("Foo", example.Id.Id); 171 Assert.Null(example.Id?.Id);
172 Assert.Equal("Foo", example[0].AsString()); 172 Assert.Equal("Foo", example[0].AsString());
173 Assert.Equal("Bar", example[1].AsString()); 173 Assert.Equal("Bar", example[1].AsString());
174 } 174 }
@@ -232,7 +232,7 @@ namespace WixToolsetTest.CoreIntegration
232 Assert.Equal(@"other.txt", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path); 232 Assert.Equal(@"other.txt", fileTuples[1][FileTupleFields.Source].PreviousValue.AsPath().Path);
233 233
234 var examples = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).ToArray(); 234 var examples = section.Tuples.Where(t => t.Definition.Type == TupleDefinitionType.MustBeFromAnExtension).ToArray();
235 Assert.Equal(new[] { "Foo", "Other" }, examples.Select(t => t.Id.Id).ToArray()); 235 Assert.Equal(new string[] { null, null }, examples.Select(t => t.Id?.Id).ToArray());
236 Assert.Equal(new[] { "Foo", "Other" }, examples.Select(t => t.AsString(0)).ToArray()); 236 Assert.Equal(new[] { "Foo", "Other" }, examples.Select(t => t.AsString(0)).ToArray());
237 Assert.Equal(new[] { "Bar", "Value" }, examples.Select(t => t[1].AsString()).ToArray()); 237 Assert.Equal(new[] { "Bar", "Value" }, examples.Select(t => t[1].AsString()).ToArray());
238 } 238 }