irc/pkg/ircdecoder/decoder_test.go

24 lines
449 B
Go
Raw Normal View History

2024-05-14 05:51:42 +00:00
package ircdecoder_test
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
"tuxpa.in/a/irc/pkg/ircdecoder"
"tuxpa.in/a/irc/pkg/ircv3"
)
func TestDecoder(t *testing.T) {
dec := ircdecoder.Decoder{}
buf := strings.NewReader("@some :source HELLO")
msg := new(ircv3.Message)
err := dec.Decode(buf, msg)
require.NoError(t, err)
require.EqualValues(t, "HELLO", msg.Command)
require.EqualValues(t, "", msg.Tags["some"])
}