This commit is contained in:
Chris
2025-11-13 15:18:28 -08:00
committed by GitHub
Unverified
parent bc6bbc20d1
commit 692ad48023
2 changed files with 13 additions and 0 deletions
@@ -40,6 +40,12 @@ internal static class PortableValueExtensions
private static TableValue ToTable(this PortableValue[] values)
{
FormulaValue[] formulaValues = values.Select(value => value.ToFormula()).ToArray();
if (formulaValues.Length == 0)
{
return FormulaValue.NewTable(RecordType.Empty());
}
if (formulaValues[0] is RecordValue recordValue)
{
return FormulaValue.NewTable(ParseRecordType(recordValue), formulaValues.OfType<RecordValue>());
@@ -53,6 +53,13 @@ public sealed class PortableValueExtensionsTests
[Fact]
public void ChatMessageType() => TestValidType(new ChatMessage(ChatRole.User, "input"), RecordType.Empty());
[Fact]
public void ListEmptyType()
{
TableValue convertedValue = (TableValue)TestValidType(Array.Empty<int>(), TableType.Empty());
Assert.Equal(0, convertedValue.Count());
}
[Fact]
public void ListSimpleType()
{