1
0
Fork 0
mirror of https://github.com/fluffle/goirc synced 2025-09-06 00:43:20 +00:00

Fix up parseLine to use these new-fangled constants; fix Copy doc and test.

This commit is contained in:
Alex Bramley 2013-03-10 15:54:37 +00:00
parent 0c25d2d602
commit 332ff0a27d
2 changed files with 11 additions and 9 deletions

View file

@ -5,7 +5,7 @@ import (
"time"
)
func TestCopy(t *testing.T) {
func TestLineCopy(t *testing.T) {
l1 := &Line{
Nick: "nick",
Ident: "ident",
@ -22,7 +22,7 @@ func TestCopy(t *testing.T) {
// Ugly. Couldn't be bothered to bust out reflect and actually think.
if l2.Nick != "nick" || l2.Ident != "ident" || l2.Host != "host" ||
l2.Src != "src" || l2.Cmd != "cmd" || l2.Raw != "raw" ||
l2.Args[0] != "arg" || l2.Args[1] != "text" {
l2.Args[0] != "arg" || l2.Args[1] != "text" || l2.Time != l1.Time {
t.Errorf("Line not copied correctly")
t.Errorf("l1: %#v\nl2: %#v", l1, l2)
}
@ -33,10 +33,11 @@ func TestCopy(t *testing.T) {
l2.Host = ""
l2.Args[0] = l2.Args[0][1:]
l2.Args[1] = "bar"
l2.Time = time.Now()
if l1.Nick != "nick" || l1.Ident != "ident" || l1.Host != "host" ||
l1.Src != "src" || l1.Cmd != "cmd" || l1.Raw != "raw" ||
l1.Args[0] != "arg" || l1.Args[1] != "text" {
l1.Args[0] != "arg" || l1.Args[1] != "text" || l1.Time == l2.Time {
t.Errorf("Original modified when copy changed")
t.Errorf("l1: %#v\nl2: %#v", l1, l2)
}