diff options
| author | Paul Buetow <paul@buetow.org> | 2025-04-16 16:33:19 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2025-04-16 16:33:19 +0300 |
| commit | 3f44fb1af8b489a37019cdd8164d2f7ca673f16f (patch) | |
| tree | 8f3bacd5b5544027dfc10fb749c0ff94ce338e87 /internal/eventloop_test.go | |
| parent | 2c5499a26593d8e4fb80c4c8415d2bd1181b5eb1 (diff) | |
fix comm
Diffstat (limited to 'internal/eventloop_test.go')
| -rw-r--r-- | internal/eventloop_test.go | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/internal/eventloop_test.go b/internal/eventloop_test.go index c1d57c8..208add6 100644 --- a/internal/eventloop_test.go +++ b/internal/eventloop_test.go @@ -57,38 +57,28 @@ func addOpenFileTest1(t *testing.T, inCh chan<- []byte, validateCh chan<- valida inCh <- exitEvBytes inCh <- exitEvBytes // Should be discarded by the event loop automatically - // Define the validation function and send it to the validateCh channel - validate := func(t *testing.T, ev *event.Pair) { - if ev.EnterEv.GetTraceId() != enterEv.TraceId { - t.Errorf("Expected TraceId '%v' but got '%v'", enterEv.TraceId, ev.EnterEv.GetTraceId()) - } - t.Log(fmt.Sprintf("Event pair '%v' appears fine", ev)) - } - validateCh <- validate -} - -func addOpenFileTest2(t *testing.T, inCh chan<- []byte, validateCh chan<- validateFunc) { - enterEv, enterEvBytes := makeEnterOpenEvent(t) - _, exitEvBytes := makeExitOpenEvent(t) - inCh <- enterEvBytes - inCh <- enterEvBytes - inCh <- exitEvBytes - - // Define the validation function and send it to the validateCh channel - validate := func(t *testing.T, ev *event.Pair) { - if ev.EnterEv.GetTraceId() != enterEv.TraceId { - t.Errorf("Expected TraceId '%v' but got '%v'", enterEv.TraceId, ev.EnterEv.GetTraceId()) + validateCh <- func(t *testing.T, ep *event.Pair) { + if ep.EnterEv.GetTraceId() != enterEv.TraceId { + t.Errorf("Expected TraceId '%v' but got '%v'", enterEv.TraceId, ep.EnterEv.GetTraceId()) return } - filenameA := ev.FileName() + filenameA := ep.FileName() filenameB := file.StringValue(enterEv.Filename[:]) if filenameA != filenameB { t.Errorf("Expected file name '%v' but got '%v'", filenameB, filenameA) return } - t.Log(fmt.Sprintf("Event pair '%v' appears fine", ev)) + comm := file.StringValue(enterEv.Comm[:]) + if ep.Comm != comm { + t.Errorf("Expected comm name '%v' but got '%v'", comm, ep.Comm) + return + } + t.Log(fmt.Sprintf("Event pair '%v' appears fine", ep)) } - validateCh <- validate +} + +func addOpenFileTest2(t *testing.T, inCh chan<- []byte, validateCh chan<- validateFunc) { + } func makeEnterOpenEvent(t *testing.T) (types.OpenEvent, []byte) { |
