Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Summarize Display name bug. (Not to merge) #2801

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading