Skip to content

Commit

Permalink
Summarize Display name bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jas-valgotar committed Jan 2, 2025
1 parent dd757da commit c1910be
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/tests/Microsoft.PowerFx.Core.Tests.Shared/TexlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c1910be

Please sign in to comment.