(t *testing.T)
| 89 | } |
| 90 | |
| 91 | func TestFunctionCall_Outputs(t *testing.T) { |
| 92 | t.Run("emits returns with emit-mode bindings", func(t *testing.T) { |
| 93 | fn := &engine.Function{ |
| 94 | Info: workflowapi.FunctionInfo{ |
| 95 | Id: "fn2", |
| 96 | Name: "two-returns", |
| 97 | Returns: []workflowapi.Variable{ |
| 98 | {Uid: "r1", Name: "first", DataType: workflowapi.Int}, |
| 99 | {Uid: "r2", Name: "second", DataType: workflowapi.String}, |
| 100 | }, |
| 101 | }, |
| 102 | } |
| 103 | fc := &FunctionCall{} |
| 104 | // Construct manually to control bindings. |
| 105 | fc, err := NewFunctionCall("fc", fn, |
| 106 | map[string]workflowapi.Expression{}, |
| 107 | map[string]workflowapi.OutputBinding{ |
| 108 | "r1": {Active: true, Mode: workflowapi.OutputBindingModeEmit}, |
| 109 | "r2": { |
| 110 | Active: true, |
| 111 | Mode: workflowapi.OutputBindingModeAssign, |
| 112 | Target: &workflowapi.Reference{SrcId: engine.SrcDeclared, VarId: "x"}, |
| 113 | }, |
| 114 | }, |
| 115 | "", |
| 116 | ) |
| 117 | require.NoError(t, err) |
| 118 | |
| 119 | out := fc.Outputs() |
| 120 | assert.Contains(t, out, "r1") |
| 121 | assert.NotContains(t, out, "r2") // assign mode strips from emitter outputs |
| 122 | assert.Equal(t, workflowapi.Int, out["r1"]) |
| 123 | }) |
| 124 | } |
| 125 | |
| 126 | func TestFunctionCall_Execute(t *testing.T) { |
| 127 | t.Run("evaluates input bindings, runs fn, applies output bindings", func(t *testing.T) { |
nothing calls this directly
no test coverage detected