29 lines
566 B
Go
29 lines
566 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
runtime "iop/packages/go/agentruntime"
|
|
)
|
|
|
|
type testSink struct {
|
|
events []runtime.RuntimeEvent
|
|
}
|
|
|
|
func (s *testSink) Emit(_ context.Context, e runtime.RuntimeEvent) error {
|
|
s.events = append(s.events, e)
|
|
return nil
|
|
}
|
|
|
|
type mockLineEmitter struct {
|
|
name string
|
|
emitFn func(line string) ([]runtime.RuntimeEvent, error)
|
|
}
|
|
|
|
func (m *mockLineEmitter) Name() string { return m.name }
|
|
|
|
func (m *mockLineEmitter) Emit(line string) ([]runtime.RuntimeEvent, error) {
|
|
if m.emitFn != nil {
|
|
return m.emitFn(line)
|
|
}
|
|
return nil, nil
|
|
}
|