24 lines
449 B
Go
24 lines
449 B
Go
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"])
|
|
}
|