mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-09 23:24:05 -08:00
Refactor lexer tests to use testify.
Signed-off-by: Paweł Szulik <paul.szulik@gmail.com>
This commit is contained in:
parent
b0c538787d
commit
1a47c7d59b
|
@ -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…
Reference in a new issue