Add null data buffer error handler and unit test, resolve TODOs

This commit is contained in:
ado
2024-02-19 01:00:42 +01:00
parent 775b8c93e2
commit aaa22046a5
3 changed files with 76 additions and 35 deletions

View File

@@ -21,6 +21,25 @@ TEST_CASE("test file not found") {
}
}
TEST_CASE("test null buffer") {
{
ss::parser p{nullptr, 10, ","};
CHECK_FALSE(p.valid());
}
{
ss::parser<ss::string_error> p{nullptr, 10, ","};
CHECK_FALSE(p.valid());
}
try {
ss::parser<ss::throw_on_error> p{nullptr, 10, ","};
FAIL("Expected exception...");
} catch (const std::exception& e) {
CHECK_FALSE(std::string{e.what()}.empty());
}
}
template <bool buffer_mode, typename... Ts>
void test_various_cases() {
unique_file_name f{"test_parser"};