MCPcopy Create free account
hub / github.com/github/gh-aw / TestAndNode_Render_OrNodeWrapped

Function TestAndNode_Render_OrNodeWrapped

pkg/workflow/expression_optimizer_test.go:649–657  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

647}
648
649func TestAndNode_Render_OrNodeWrapped(t *testing.T) {
650 // OrNode as AND operand MUST be wrapped to preserve precedence.
651 a := cmp(prop("a"), "==", str("1"))
652 b := cmp(prop("b"), "==", str("2"))
653 c := cmp(prop("c"), "==", str("3"))
654 node := and2(or2(a, b), c)
655 rendered := OptimizeExpression(node).Render()
656 assert.Equal(t, "(a == '1' || b == '2') && c == '3'", rendered, "OrNode operand must be wrapped in AND")
657}
658
659func TestOrNode_Render_NoWrapping(t *testing.T) {
660 // OrNode never wraps typed children in parens.

Callers

nothing calls this directly

Calls 7

cmpFunction · 0.85
propFunction · 0.85
strFunction · 0.85
and2Function · 0.85
or2Function · 0.85
OptimizeExpressionFunction · 0.85
RenderMethod · 0.65

Tested by

no test coverage detected