From c1910be8a6ca54957e38235bdc81ae3ef44d7068 Mon Sep 17 00:00:00 2001 From: jas-valgotar Date: Thu, 2 Jan 2025 11:25:31 -0500 Subject: [PATCH] Summarize Display name bug. --- .../TexlTests.cs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs b/src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs index 69196a9c9d..7bcbf6d2c1 100644 --- a/src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs +++ b/src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs @@ -4370,7 +4370,7 @@ public void TestBlobFunction(string expression, string expectedType) } [Theory] - [InlineData("Table(DS, Blank())", "*[Id:n, Name:s, Age:n]", 1)] + [InlineData("Table(DS, Blank())", "*[d:n, Name:s, Age:n]", 1)] [InlineData("Table(DS, T1)", "*[Id:n, Name:s, Age:n, a:n, b:s]", 1)] [InlineData("Table(DS, Filter(DS, Name = \"Foo\"))", "*[Id:n, Name:s, Age:n]", 2)] [InlineData("Table([], Table(DS, []))", "*[Id:n, Name:s, Age:n]", 1)] @@ -4424,6 +4424,31 @@ public void TestTypeLiteralsNegative(string script, string expectedSchema) features: Features.PowerFxV1); } + [Fact] + public void TestSummarizeDisplayName() + { + var record = RecordType.Empty().Add("logicalField", FormulaType.Number, "DisplayField").Add("logicalField2", FormulaType.String, "DisplayFiled2"); + + var symbol = new SymbolTable(); + symbol.AddVariable("DS", record.ToTable()); + symbol.AddFunction(new SummarizeFunction()); + + var config = new PowerFxConfig + { + SymbolTable = symbol + }; + + var engine = new Engine(config); + + var logicalCheck = engine.Check("First(Summarize(DS, logicalField, logicalField2)).logicalField"); + + Assert.True(logicalCheck.IsSuccess); + + var displayCheck = engine.Check("First(Summarize(DS, logicalField, logicalField2)).DisplayField"); + + Assert.True(displayCheck.IsSuccess); + } + private void TestBindingPurity(string script, bool isPure, SymbolTable symbolTable = null) { var config = new PowerFxConfig