mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 13:57:36 -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
|
hasError = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !hasError {
|
require.True(t, hasError, "%d: input %q, expected lexing error but did not fail", i, test.input)
|
||||||
t.Logf("%d: input %q", i, test.input)
|
|
||||||
require.Fail(t, "expected lexing error but did not fail")
|
|
||||||
}
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if lastItem.Typ == ERROR {
|
require.NotEqual(t, ERROR, lastItem.Typ, "%d: input %q, unexpected lexing error at position %d: %s", i, test.input, lastItem.Pos, lastItem)
|
||||||
t.Logf("%d: input %q", i, test.input)
|
|
||||||
require.Fail(t, "unexpected lexing error at position %d: %s", lastItem.Pos, lastItem)
|
|
||||||
}
|
|
||||||
|
|
||||||
eofItem := Item{EOF, posrange.Pos(len(test.input)), ""}
|
eofItem := Item{EOF, posrange.Pos(len(test.input)), ""}
|
||||||
require.Equal(t, lastItem, eofItem, "%d: input %q", i, test.input)
|
require.Equal(t, lastItem, eofItem, "%d: input %q", i, test.input)
|
||||||
|
|
Loading…
Reference in a new issue