29 lines
504 B
Go
29 lines
504 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
|
||
|
package interrogator;
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"feudal/message"
|
||
|
)
|
||
|
|
||
|
func TestInterrogator(t *testing.T) {
|
||
|
i := New()
|
||
|
m := message.New("foo", i)
|
||
|
go i.Send(m)
|
||
|
r := <- i
|
||
|
if r.Body() != "foo" {
|
||
|
t.Errorf("Invalid message")
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestBufferedInterrogator(t *testing.T) {
|
||
|
i := NewBuffered(1)
|
||
|
m := message.New("foo", i)
|
||
|
i.Send(m)
|
||
|
r := <- i
|
||
|
if r.Body() != "foo" {
|
||
|
t.Errorf("Invalid message")
|
||
|
}
|
||
|
}
|