From 271158d87e8a497a9c57e7df87b30d9ffd000308 Mon Sep 17 00:00:00 2001 From: Arash Maymandi <27716912+am357@users.noreply.github.com> Date: Wed, 9 Feb 2022 15:37:36 -0800 Subject: [PATCH] CAST: Improve the CAST assertion assertEval (#523) Improve the CAST assertion assertEval with removing a redundant assertion for permissive mode since we already run tests for this mode as part of the overall process. Issue #, if available: 519 Description of changes: Parameterize the error message. --- .../org/partiql/lang/eval/EvaluatorTestBase.kt | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/lang/test/org/partiql/lang/eval/EvaluatorTestBase.kt b/lang/test/org/partiql/lang/eval/EvaluatorTestBase.kt index fe2c1d60f..fab8db534 100644 --- a/lang/test/org/partiql/lang/eval/EvaluatorTestBase.kt +++ b/lang/test/org/partiql/lang/eval/EvaluatorTestBase.kt @@ -97,20 +97,9 @@ abstract class EvaluatorTestBase : TestBase() { val originalExprNode = parser.parseExprNode(source) fun evalAndAssert(exprNodeToEvaluate: ExprNode, message: String) { - // LEGACY mode - val result = eval(exprNodeToEvaluate, compileOptions, session, compilerPipelineBuilderBlock) - AssertExprValue(result, message = "(LEGACY mode) Evaluated '$source' with evaluator ($message)") - .apply { assertIonValue(expectedIon) }.run(block) - // TODO this should not be here--this should be explicit in the test case - // PERMISSIVE mode - val resultForPermissiveMode = eval( - exprNodeToEvaluate, - CompileOptions.builder(compileOptions).typingMode(TypingMode.PERMISSIVE).build(), - session, - compilerPipelineBuilderBlock - ) - AssertExprValue(resultForPermissiveMode, message = "(PERMISSIVE mode) Evaluated '$source' with evaluator ($message)") - .apply { assertIonValue(expectedIon) }.run(block) + AssertExprValue(eval(exprNodeToEvaluate, compileOptions, session, compilerPipelineBuilderBlock), + message = "${compileOptions.typedOpBehavior} CAST in ${compileOptions.typingMode} typing mode, " + + "evaluated '$source' with evaluator ($message)").apply { assertIonValue(expectedIon) }.run(block) } // Evaluate the ExprNodes originally obtained from the parser