1
0
mirror of https://gitlab.crans.org/nounous/ghostream.git synced 2025-06-29 22:41:06 +02:00

Use []byte for stream data

This commit is contained in:
Alexandre Iooss
2020-10-17 10:21:40 +02:00
parent 73e6be1274
commit e0911ab050
2 changed files with 12 additions and 12 deletions

View File

@ -7,7 +7,7 @@ import (
func TestWithoutOutputs(t *testing.T) {
stream := New()
defer stream.Close()
stream.Broadcast <- "hello world"
stream.Broadcast <- []byte("hello world")
}
func TestWithOneOutput(t *testing.T) {
@ -15,14 +15,14 @@ func TestWithOneOutput(t *testing.T) {
defer stream.Close()
// Register one output
output := make(chan interface{}, 64)
output := make(chan []byte, 64)
stream.Register(output)
// Try to pass one message
stream.Broadcast <- "hello world"
stream.Broadcast <- []byte("hello world")
msg := <-output
if m, ok := msg.(string); !ok || m != "hello world" {
t.Error("Message has wrong type or content")
if string(msg) != "hello world" {
t.Errorf("Message has wrong content: %s != hello world", msg)
}
// Unregister