package net import "testing" // Regression: stripIAC required a third byte, so a trailing 2-byte IAC command // leaked its option byte into player input. func TestStripIACDropsTruncatedSequence(t *testing.T) { got := stripIAC("abc" + string([]byte{iac, 0xf1})) if got != "abc" { t.Fatalf("stripIAC(truncated) = %q, want %q", got, "abc") } // A full subnegotiation is still removed. got = stripIAC("x" + string([]byte{iac, sb, 1, 2}) + string([]byte{iac, se}) + "y") if got != "xy" { t.Fatalf("stripIAC(subnegotiation) = %q, want xy", got) } }