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

Panic with incorrect input #92

Open
johejo opened this issue Feb 13, 2021 · 0 comments
Open

Panic with incorrect input #92

johejo opened this issue Feb 13, 2021 · 0 comments

Comments

@johejo
Copy link

johejo commented Feb 13, 2021

How to reproduce

package errorformat_test

import (
	"testing"

	"github.com/reviewdog/errorformat"
)

func TestPanic(t *testing.T) {
	_, err := errorformat.NewEfm("%")
	if err == nil {
		t.Fatal("should return error")
	}
}
--- FAIL: TestPanic (0.00s)
panic: runtime error: index out of range [1] with length 1 [recovered]
        panic: runtime error: index out of range [1] with length 1

goroutine 33 [running]:
testing.tRunner.func1.1(0x5406c0, 0xc000154020)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1072 +0x30d
testing.tRunner.func1(0xc000102480)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1075 +0x41a
panic(0x5406c0, 0xc000154020)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/runtime/panic.go:969 +0x1b9
github.com/reviewdog/errorformat.NewEfm.func1(...)
        /home/heijo/ghq/github.com/reviewdog/errorformat/errorformat.go:435
github.com/reviewdog/errorformat.NewEfm(0x54feb1, 0x1, 0xc00005e770, 0x47e246, 0x60281766)
        /home/heijo/ghq/github.com/reviewdog/errorformat/errorformat.go:442 +0x93f
github.com/reviewdog/errorformat_test.TestPanic(0xc000102480)
        /home/heijo/ghq/github.com/reviewdog/errorformat/panic_test.go:10 +0x3a
testing.tRunner(0xc000102480, 0x55b548)
        /home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1123 +0xef
created by testing.(*T).Run
        /home/linuxbrew/.linuxbrew/Cellar/go/1.15.7_1/libexec/src/testing/testing.go:1168 +0x2b3
exit status 2
FAIL    github.com/reviewdog/errorformat        0.004s
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

1 participant