mirror of
https://github.com/red0124/ssp.git
synced 2025-01-23 04:55:20 +01:00
add tests for error mode
This commit is contained in:
parent
bb6296ef6e
commit
5a1e5b3877
@ -322,3 +322,16 @@ TEST_CASE("testing ss:ne restriction (not empty)") {
|
||||
CHECK(tup == extracted_vector);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("testing error mode") {
|
||||
ss::converter c;
|
||||
|
||||
c.convert<int>("junk");
|
||||
CHECK(!c.valid());
|
||||
CHECK(!c.error_msg().empty());
|
||||
|
||||
c.set_error_mode(ss::error_mode::Bool);
|
||||
c.convert<int>("junk");
|
||||
CHECK(!c.valid());
|
||||
CHECK(c.error_msg().empty());
|
||||
}
|
||||
|
@ -438,3 +438,26 @@ TEST_CASE("testing the moving of parsed composite values") {
|
||||
.or_else<std::tuple<my_string, my_string, my_string>>(
|
||||
[](auto&, auto&, auto&) {});
|
||||
}
|
||||
|
||||
TEST_CASE("testing error mode") {
|
||||
unique_file_name f;
|
||||
{
|
||||
std::ofstream out{f.name};
|
||||
out << "junk" << std::endl;
|
||||
out << "junk" << std::endl;
|
||||
}
|
||||
|
||||
ss::parser p(f.name, ",");
|
||||
|
||||
REQUIRE(!p.eof());
|
||||
p.get_next<int>();
|
||||
CHECK(!p.valid());
|
||||
CHECK(!p.error_msg().empty());
|
||||
|
||||
p.set_error_mode(ss::error_mode::Bool);
|
||||
|
||||
REQUIRE(!p.eof());
|
||||
p.get_next<int>();
|
||||
CHECK(!p.valid());
|
||||
CHECK(p.error_msg().empty());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user