smartystreets / goconvey

Go testing in the browser. Integrates with `go test`. Write behavioral tests in Go.
http://smartystreets.github.io/goconvey/
Other
8.25k stars 555 forks source link

Parser Panics #521

Open btm6084 opened 6 years ago

btm6084 commented 6 years ago

There appears to be an output parser error. Seems to require '---' as the first non-whitespace string in a given line, followed by a space, followed by anything else.

I wrote this simple test, which is enough to replicate:

package main

import (
    "fmt"
    "testing"
)

func TestGoConveyPanic(t *testing.T) {
    fmt.Println(`--- Panic`)
}
func TestGoConveyPanic(t *testing.T) {
    fmt.Println(`        --- Panic`)
}
fmt.Println(`Panic
    --- Panic`)
fmt.Println(`No Panic
a   --- No Panic`)

Full stack trace:

panic: runtime error: index out of range

goroutine 18 [running]:
github.com/smartystreets/goconvey/web/server/parser.(*outputParser).recordTestMetadata(0xc42017c150)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/packageParser.go:104 +0x1b0
github.com/smartystreets/goconvey/web/server/parser.(*outputParser).processTestOutput(0xc42017c150)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/packageParser.go:86 +0x9a
github.com/smartystreets/goconvey/web/server/parser.(*outputParser).separateTestFunctionsAndMetadata(0xc42017c150)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/packageParser.go:53 +0x45
github.com/smartystreets/goconvey/web/server/parser.(*outputParser).parse(0xc42017c150)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/packageParser.go:44 +0x2b
github.com/smartystreets/goconvey/web/server/parser.ParsePackageResults(0xc42019c180, 0xc42023a000, 0x32b)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/packageParser.go:18 +0x4d
github.com/smartystreets/goconvey/web/server/parser.(*Parser).Parse(0xc42013a000, 0xc42013a048, 0x1, 0x1)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/parser/parser.go:16 +0x29f
github.com/smartystreets/goconvey/web/server/executor.(*Executor).parse(0xc420126100, 0xc42013a048, 0x1, 0x1, 0xffffffffffffffff)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/executor/executor.go:47 +0xc8
github.com/smartystreets/goconvey/web/server/executor.(*Executor).ExecuteTests(0xc420126100, 0xc42013a048, 0x1, 0x1, 0x0)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/web/server/executor/executor.go:36 +0xa8
main.runTestOnUpdates(0xc420134060, 0x997e00, 0xc420126100, 0x99b0c0, 0xc420126140)
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/goconvey.go:120 +0x15d
created by main.main
    /home/{redacted}/golang/src/github.com/smartystreets/goconvey/goconvey.go:80 +0x616
farnasirim commented 6 years ago

Gonna check this out

farnasirim commented 5 years ago

Can't reproduce with any amount of trickery.