Add testcase for crash on nick change
This commit is contained in:
parent
83136b6c73
commit
def8cd55a7
19
irc_test.go
19
irc_test.go
@ -1,11 +1,10 @@
|
|||||||
package irc
|
package irc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "github.com/thoj/go-ircevent"
|
// "github.com/thoj/go-ircevent"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
func TestConnection(t *testing.T) {
|
func TestConnection(t *testing.T) {
|
||||||
irccon := IRC("go-eventirc", "go-eventirc")
|
irccon := IRC("go-eventirc", "go-eventirc")
|
||||||
irccon.VerboseCallbackHandler = true
|
irccon.VerboseCallbackHandler = true
|
||||||
@ -15,11 +14,17 @@ func TestConnection(t *testing.T) {
|
|||||||
}
|
}
|
||||||
irccon.AddCallback("001", func(e *Event) { irccon.Join("#go-eventirc") })
|
irccon.AddCallback("001", func(e *Event) { irccon.Join("#go-eventirc") })
|
||||||
|
|
||||||
irccon.AddCallback("366" , func(e *Event) {
|
irccon.AddCallback("366", func(e *Event) {
|
||||||
irccon.Privmsg("#go-eventirc", "Test Message\n")
|
irccon.Privmsg("#go-eventirc", "Test Message\n")
|
||||||
irccon.Quit();
|
irccon.Nick("go-eventnewnick")
|
||||||
|
})
|
||||||
|
irccon.AddCallback("NICK", func(e *Event) {
|
||||||
|
irccon.Quit()
|
||||||
|
irccon.log.Printf("NICKdf\n")
|
||||||
|
if irccon.nickcurrent == "go-eventnewnick" {
|
||||||
|
t.Fatal("Nick change did not work!")
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
irccon.Loop()
|
irccon.Loop()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,9 +38,9 @@ func TestConnectionSSL(t *testing.T) {
|
|||||||
}
|
}
|
||||||
irccon.AddCallback("001", func(e *Event) { irccon.Join("#go-eventirc") })
|
irccon.AddCallback("001", func(e *Event) { irccon.Join("#go-eventirc") })
|
||||||
|
|
||||||
irccon.AddCallback("366" , func(e *Event) {
|
irccon.AddCallback("366", func(e *Event) {
|
||||||
irccon.Privmsg("#go-eventirc", "Test Message\n")
|
irccon.Privmsg("#go-eventirc", "Test Message\n")
|
||||||
irccon.Quit();
|
irccon.Quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
irccon.Loop()
|
irccon.Loop()
|
||||||
|
Loading…
Reference in New Issue
Block a user