From 1a47c7d59bef3c8aac2be0b5d65517ea1ae1ddeb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Szulik?= Date: Wed, 15 Sep 2021 14:22:37 +0200 Subject: [PATCH] Refactor lexer tests to use testify. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Paweł Szulik --- promql/parser/lex_test.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/promql/parser/lex_test.go b/promql/parser/lex_test.go index 23c9dfbee..4a29351b0 100644 --- a/promql/parser/lex_test.go +++ b/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)