Add UNSUB_SPC parser state

This commit is contained in:
Waldemar Quevedo
2016-02-02 21:38:57 -08:00
parent ed7a0b1852
commit 86824713c6
2 changed files with 36 additions and 0 deletions

View File

@@ -380,6 +380,34 @@ func TestShouldFail(t *testing.T) {
if err := c.parse([]byte("PUB foo 2\r\nok\r \n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUBUNSUB 1\r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB_2\r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB_UNSUB_UNSUB 2\r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB_\t2\r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB\r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB \r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
c.state = OP_START
if err := c.parse([]byte("UNSUB \t \r\n")); err == nil {
t.Fatal("Should have received a parse error")
}
}
func TestProtoSnippet(t *testing.T) {