Merge pull request #1925 from hashmap/1898-test-race

Fix data race in lexer and lexer test
This commit is contained in:
Fabian Reinartz 2016-08-29 09:28:02 +02:00 committed by GitHub
commit 23ddbd64aa
2 changed files with 7 additions and 3 deletions

View file

@ -38,7 +38,7 @@ check_license:
test:
@echo ">> running tests"
@$(GO) test -short $(pkgs)
@$(GO) test -race -short $(pkgs)
format:
@echo ">> formatting code"

View file

@ -438,8 +438,12 @@ var tests = []struct {
// for the parser to avoid duplicated effort.
func TestLexer(t *testing.T) {
for i, test := range tests {
l := lex(test.input)
l.seriesDesc = test.seriesDesc
l := &lexer{
input: test.input,
items: make(chan item),
seriesDesc: test.seriesDesc,
}
go l.run()
out := []item{}
for it := range l.items {