go-twitch-irc
go-twitch-irc copied to clipboard
Non spec compliant unit test
https://github.com/gempir/go-twitch-irc/blob/1ea7808b29d47893ee3a0081c9885b3ea2cfeeba/test_resources/irctests.json#L205-L215
In this test, the expected output for the parameters is [""]
(single element list, holding an empty string).
I think the IRC spec disagrees on this: https://tools.ietf.org/html/rfc2812#section-2.3.1 relevant part:
params = *14( SPACE middle ) [ SPACE ":" trailing ]
middle = nospcrlfcl *( ":" / nospcrlfcl )
nospcrlfcl = %x01-09 / %x0B-0C / %x0E-1F / %x21-39 / %x3B-FF
; any octet except NUL, CR, LF, " " and ":"
So in essence the space between "middle" parameters is "used up" by the SPACE
in the definition of params
, and then middle
first expects something that is not a space. From my understanding this means that multiple spaces are not allowed between middle parameters, and the IRC test under question should be an error.
There is also another unit test that relies on this behaviour: https://github.com/gempir/go-twitch-irc/blob/1ea7808b29d47893ee3a0081c9885b3ea2cfeeba/test_resources/irctests.json#L326-L338
I think this test case is taken from this bug discussion: https://bugzilla.mozilla.org/show_bug.cgi?id=954972 Where it was already discussed that sending a message like this would break IRC message parsers.