(t *testing.T)
| 199 | } |
| 200 | |
| 201 | func TestFrameParent(t *testing.T) { |
| 202 | baseAct, err := NewActivation(map[string]any{"x": 1}) |
| 203 | if err != nil { |
| 204 | t.Fatalf("NewActivation(x) failed: %v", err) |
| 205 | } |
| 206 | childAct, err := NewActivation(map[string]any{"y": 2}) |
| 207 | if err != nil { |
| 208 | t.Fatalf("NewActivation(y) failed: %v", err) |
| 209 | } |
| 210 | |
| 211 | tests := []struct { |
| 212 | name string |
| 213 | setup func() (*ExecutionFrame, func()) |
| 214 | want Activation |
| 215 | }{ |
| 216 | { |
| 217 | name: "base frame has no parent activation", |
| 218 | setup: func() (*ExecutionFrame, func()) { |
| 219 | f := mustNewExecutionFrame(t, baseAct) |
| 220 | return f, func() { f.Close() } |
| 221 | }, |
| 222 | want: nil, |
| 223 | }, |
| 224 | { |
| 225 | name: "pushed frame returns parent activation", |
| 226 | setup: func() (*ExecutionFrame, func()) { |
| 227 | f := mustNewExecutionFrame(t, baseAct) |
| 228 | child := f.Push(childAct) |
| 229 | return child, func() { |
| 230 | child.Pop() |
| 231 | f.Close() |
| 232 | } |
| 233 | }, |
| 234 | want: baseAct, |
| 235 | }, |
| 236 | } |
| 237 | |
| 238 | for _, tc := range tests { |
| 239 | t.Run(tc.name, func(t *testing.T) { |
| 240 | frame, cleanup := tc.setup() |
| 241 | defer cleanup() |
| 242 | |
| 243 | if got := frame.Parent(); got != tc.want { |
| 244 | t.Errorf("Parent() got %v, want %v", got, tc.want) |
| 245 | } |
| 246 | }) |
| 247 | } |
| 248 | } |
| 249 | |
| 250 | func TestFrameUnwrap(t *testing.T) { |
| 251 | baseAct, err := NewActivation(map[string]any{"x": 1}) |
nothing calls this directly
no test coverage detected