Skip to content

Commit

Permalink
test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jas-valgotar committed Mar 21, 2024
1 parent c295427 commit aba9876
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#SETUP: StronglyTypedBuiltinEnums

// Table type enum (square bracket notation), cannot have numbers
>> [{a:ErrorKind.Div0}, {a:12}]
Errors: Error 21-27: Incompatible type. The 'a' column in the data source you're updating expects a 'Enum (ErrorKind)' type and you're using a 'Decimal' type.
>> [{a:ErrorKind.Div0}, {a:Sqrt(1)}]
Errors: Error 21-32: Incompatible type. The 'a' column in the data source you're updating expects a 'Enum (ErrorKind)' type and you're using a 'Number' type.

// Table type enum (square bracket notation, unwrapped), cannot have numbers
>> [ErrorKind.Div0, 12]
Errors: Error 17-19: Incompatible type. The item you are trying to put into a table required the type 'Enum (ErrorKind)', but found the type 'Decimal', which is not compatible with the table.
>> [ErrorKind.Div0, Sqrt(1)]
Errors: Error 17-24: Incompatible type. The item you are trying to put into a table required the type 'Enum (ErrorKind)', but found the type 'Number', which is not compatible with the table.

// Table type enum (Table function), cannot have numbers
>> Table({a:ErrorKind.Div0}, {a:Sqrt(1)})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class DeferredTypeTests
[InlineData("Text(X)", "s")]
[InlineData("Value(X)", "n")]
[InlineData("Boolean(X)", "b")]
[InlineData("Index([1,2,3].Value, X)", "![Value:n]")]
[InlineData("Index([1,2,3], X)", "![Value:n]")]
[InlineData("Sum(X, 1) < 5", "b")]
[InlineData("Sum(X, 1, R) < 5", "b")] // All error are discarded for function calls, hence we don't get error for RecordType here.
[InlineData("Sum(X, T) < 5", "b")] // Since we discard all errors for function calls, Function calls are biased to non tabular overload.
Expand Down Expand Up @@ -87,7 +87,7 @@ public void DeferredTypeTest(string script, string expectedReturnType)
symbolTable.AddVariable("N", FormulaType.Number, mutable: true);
symbolTable.AddVariable("XM", FormulaType.Deferred, mutable: true);

TestDeferredTypeBindingWarning(script, Features.None, TestUtils.DT(expectedReturnType), symbolTable, numberIsFloat: true);
TestDeferredTypeBindingWarning(script, Features.PowerFxV1, TestUtils.DT(expectedReturnType), symbolTable, numberIsFloat: true);
}

[Theory]
Expand All @@ -113,7 +113,7 @@ public void DeferredTypeTest_Negative(string script, string errorMessage)
symbolTable.AddVariable("X", FormulaType.Deferred);
symbolTable.AddVariable("N", FormulaType.Number);
symbolTable.AddVariable("R", RecordType.Empty());
TestBindingError(script, Features.None, errorMessage, symbolTable);
TestBindingError(script, Features.PowerFxV1, errorMessage, symbolTable);
}

[Fact]
Expand Down

0 comments on commit aba9876

Please sign in to comment.