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

Function TestRealWorld_SafeOutputCondition

pkg/workflow/expression_optimizer_test.go:513–523  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Real-world patterns from lock files ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

511// ---------------------------------------------------------------------------
512
513func TestRealWorld_SafeOutputCondition(t *testing.T) {
514 // (!cancelled()) && (needs.agent.result != 'skipped')
515 // This must remain unchanged because it contains a status function.
516 notCancelled := not1(fn("cancelled"))
517 agentNotSkipped := cmp(prop("needs.agent.result"), "!=", str("skipped"))
518 node := and2(notCancelled, agentNotSkipped)
519 result := OptimizeExpression(node)
520 rendered := result.Render()
521 assert.Contains(t, rendered, "cancelled()", "cancelled() must be preserved")
522 assert.Contains(t, rendered, "needs.agent.result != 'skipped'", "agent-not-skipped condition must be preserved")
523}
524
525func TestRealWorld_ReactionConditionDedup(t *testing.T) {
526 // Build the same event-type condition twice to simulate a duplicate being

Callers

nothing calls this directly

Calls 8

not1Function · 0.85
fnFunction · 0.85
cmpFunction · 0.85
propFunction · 0.85
strFunction · 0.85
and2Function · 0.85
OptimizeExpressionFunction · 0.85
RenderMethod · 0.65

Tested by

no test coverage detected