Refactor lexer tests to use testify.

Signed-off-by: Paweł Szulik <paul.szulik@gmail.com>
pull/9298/head
Paweł Szulik 4 years ago committed by Bryan Boreham
parent b0c538787d
commit 1a47c7d59b
  1. 10
      promql/parser/lex_test.go

@ -815,16 +815,10 @@ func TestLexer(t *testing.T) {
hasError = true
}
}
if !hasError {
t.Logf("%d: input %q", i, test.input)
require.Fail(t, "expected lexing error but did not fail")
}
require.True(t, hasError, "%d: input %q, expected lexing error but did not fail", i, test.input)
continue
}
if lastItem.Typ == ERROR {
t.Logf("%d: input %q", i, test.input)
require.Fail(t, "unexpected lexing error at position %d: %s", lastItem.Pos, lastItem)
}
require.NotEqual(t, ERROR, lastItem.Typ, "%d: input %q, unexpected lexing error at position %d: %s", i, test.input, lastItem.Pos, lastItem)
eofItem := Item{EOF, posrange.Pos(len(test.input)), ""}
require.Equal(t, lastItem, eofItem, "%d: input %q", i, test.input)

Loading…
Cancel
Save