--------------------------------------------------------------------------- Real-world patterns from lock files ---------------------------------------------------------------------------
(t *testing.T)
| 511 | // --------------------------------------------------------------------------- |
| 512 | |
| 513 | func 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 | |
| 525 | func TestRealWorld_ReactionConditionDedup(t *testing.T) { |
| 526 | // Build the same event-type condition twice to simulate a duplicate being |