README.md rules that nicks are case-sensitive, but the IRC listener's relay and user MODE on both transports compared nicks ignoring case: an IRC listener user alice never saw a PRIVMSG, NOTICE, JOIN, PART, NICK or QUIT from Alice, and MODE Alice from alice was taken as her own nick. These checks now use ==. Tests cover alice receiving each of these from Alice, MODE Alice from alice getting 502 on both transports, and Alice registering while alice exists. README.md drops the text that described the old behaviour. Model: opus-5-5
This commit was merged in pull request #141.
This commit is contained in:
@@ -185,3 +185,39 @@ func TestRelayLineBreaks(t *testing.T) {
|
||||
t.Errorf("got %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
// TestRelayNickDiffersOnlyInCase checks that an IRC listener
|
||||
// user alice receives a JOIN, PRIVMSG, PART, NICK and QUIT
|
||||
// from Alice in a channel they share: nicks are
|
||||
// case-sensitive, so Alice is someone else.
|
||||
func TestRelayNickDiffersOnlyInCase(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newTestEnv(t)
|
||||
|
||||
alice := env.dial(t)
|
||||
alice.register("alice")
|
||||
alice.joinAndDrain("#case")
|
||||
|
||||
capitalAlice := env.dial(t)
|
||||
capitalAlice.register("Alice")
|
||||
|
||||
for _, step := range []struct {
|
||||
line, want string
|
||||
}{
|
||||
{"JOIN #case", ":Alice!Alice@* JOIN #case"},
|
||||
{"PRIVMSG #case :hi there", ":Alice!Alice@* PRIVMSG #case :hi there"},
|
||||
{"PART #case :see you", ":Alice!Alice@* PART #case :see you"},
|
||||
{"JOIN #case", ":Alice!Alice@* JOIN #case"},
|
||||
{"NICK Alicia", ":Alice!Alice@* NICK Alicia"},
|
||||
{"NICK Alice", ":Alicia!Alicia@* NICK Alice"}, // back for QUIT
|
||||
{"QUIT", ":Alice!Alice@* QUIT :Quit: Connection closed"},
|
||||
} {
|
||||
capitalAlice.send(step.line)
|
||||
|
||||
got := alice.readLine()
|
||||
if got != step.want {
|
||||
t.Errorf("%s: got %q, want %q", step.line, got, step.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user