From 0603915627be54f0801643dea62efecaaabe15b5 Mon Sep 17 00:00:00 2001 From: Henrique Costa Date: Thu, 30 Apr 2026 15:03:35 +0200 Subject: [PATCH] test: cover qualified function calls with three segments Symptom: the qualified function call regression coverage only asserted a two-segment callee and left the bug-test coverage implicit. Root cause: the expression parser fix accepts qualifiedName callees, including three-segment names, but the tests did not pin that shape directly. Fix: update the visitor regression to use a synthetic three-segment callee and add a parser-level bug-test MDL file that checks the same IF-condition form. Tests: ran make build, targeted mdl/visitor qualified-call tests, mxcli check for the bug-test MDL file, make test, and make lint-go. --- .../qualified-function-call-expression.mdl | 31 +++++++++++++++++++ mdl/visitor/visitor_qualified_call_test.go | 8 ++--- 2 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 mdl-examples/bug-tests/qualified-function-call-expression.mdl diff --git a/mdl-examples/bug-tests/qualified-function-call-expression.mdl b/mdl-examples/bug-tests/qualified-function-call-expression.mdl new file mode 100644 index 00000000..a9e81c59 --- /dev/null +++ b/mdl-examples/bug-tests/qualified-function-call-expression.mdl @@ -0,0 +1,31 @@ +-- ============================================================================ +-- Regression: Qualified function calls in microflow expressions +-- ============================================================================ +-- +-- Symptom: +-- Qualified function/microflow-style calls used as IF conditions failed to +-- parse when the expression callee was not a built-in function name. +-- +-- After fix: +-- The expression grammar accepts qualified names as function call targets, +-- including three-segment names emitted by describe for rule-like split +-- conditions. +-- +-- Usage: +-- mxcli check mdl-examples/bug-tests/qualified-function-call-expression.mdl +-- ============================================================================ + +create module SyntheticQualifiedCall; + +create microflow SyntheticQualifiedCall.MF_QualifiedCall ( + $S: string +) +returns boolean as $Result +begin + if SyntheticRules.Strings.IsNotEmpty(String = $S) then + return true; + else + return false; + end if; +end; +/ diff --git a/mdl/visitor/visitor_qualified_call_test.go b/mdl/visitor/visitor_qualified_call_test.go index a97286a9..14e67f1f 100644 --- a/mdl/visitor/visitor_qualified_call_test.go +++ b/mdl/visitor/visitor_qualified_call_test.go @@ -15,9 +15,9 @@ import ( // failed to parse with `mismatched input '(' expecting THEN`, blocking the // roundtrip for microflows whose ExclusiveSplit uses a RuleSplitCondition. func TestQualifiedCallInIfCondition(t *testing.T) { - input := `CREATE OR MODIFY MICROFLOW MxAdmin.Test ($S: String) returns Boolean + input := `CREATE OR MODIFY MICROFLOW SyntheticQualifiedCall.Test ($S: String) returns Boolean BEGIN - IF ControlCenterCommons.IsNotEmptyString(String = $S) THEN + IF SyntheticRules.Strings.IsNotEmpty(String = $S) THEN RETURN true; ELSE RETURN false; @@ -45,8 +45,8 @@ END` if !ok { t.Fatalf("expected FunctionCallExpr as if-condition, got %T", ifStmt.Condition) } - if call.Name != "ControlCenterCommons.IsNotEmptyString" { - t.Errorf("call name = %q, want %q", call.Name, "ControlCenterCommons.IsNotEmptyString") + if call.Name != "SyntheticRules.Strings.IsNotEmpty" { + t.Errorf("call name = %q, want %q", call.Name, "SyntheticRules.Strings.IsNotEmpty") } if len(call.Arguments) != 1 { t.Fatalf("expected 1 argument, got %d", len(call.Arguments))