Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests failing in a clean environment. #3

Open
kbalonek opened this issue Feb 23, 2016 · 2 comments
Open

Unit tests failing in a clean environment. #3

kbalonek opened this issue Feb 23, 2016 · 2 comments

Comments

@kbalonek
Copy link

Running inside the official golang:1.6 Docker image, using stretchr/testify revision 1f4a1643a57e (on master), the unit tests are failing:

docker run -it --rm golang:1.6
$ /go# go get github.com/manucorporat/sse
$ /go# go get github.com/stretchr/testify/assert
$ /go# cd src/github.com/manucorporat/sse
$ /go/src/github.com/manucorporat/sse# go test .
--- FAIL: TestEncodeOnlyData (0.00s)
        Error Trace:    sse_test.go:31
    Error:      Not equal: []sse.Event{sse.Event{Event:"message", Id:"", Retry:0x0, Data:"junk\n\njk\nid:fake"}} (expected)
                    != []sse.Event{sse.Event{Event:"", Id:"", Retry:0x0, Data:"junk\n\njk\nid:fake"}} (actual)

            Diff:
            --- Expected
            +++ Actual
            @@ -2,3 +2,3 @@
              (sse.Event) {
            -  Event: (string) (len=7) "message",
            +  Event: (string) "",
               Id: (string) "",

--- FAIL: TestEncodeWithEvent (0.00s)
        Error Trace:    sse_test.go:52
    Error:      Not equal: []sse.Event{sse.Event{Event:"t\\n:<>\\r\test", Id:"", Retry:0x0, Data:"junk\n\njk\nid:fake"}} (expected)
                    != []sse.Event{sse.Event{Event:"t\n:<>\r\test", Id:"", Retry:0x0, Data:"junk\n\njk\nid:fake"}} (actual)

            Diff:
            --- Expected
            +++ Actual
            @@ -2,3 +2,3 @@
              (sse.Event) {
            -  Event: (string) (len=12) "t\\n:<>\\r\test",
            +  Event: (string) (len=10) "t\n:<>\r\test",
               Id: (string) "",

FAIL
FAIL    github.com/manucorporat/sse 0.003s
@satta
Copy link

satta commented Jun 19, 2017

I can confirm this issue still exists. Is this an issue with the tests or an actual problem?

@ahxxm
Copy link

ahxxm commented Feb 3, 2018

this issue still exists, my 2¢:

TestEncodeOnlyData

This is an issue with test. The event type will be set to message if it's empty, which complies with the spec.

TestEncodeWithEvent

This is an actual decoder problem. CRLF/CR/LF are all line ending signal. If t\n:<>\r\test appeared after event:, it should be parsed into those tokens:

  • event:t: event type was t
  • \n: event type line ends
  • :<>: ignored
  • \r: ignored line ends
  • \test: "using the whole line as the field name, and the empty string as the field value."
    (ref)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants