mirror of
https://github.com/red0124/ssp.git
synced 2025-01-23 04:55:20 +01:00
make default error_mode Bool
This commit is contained in:
parent
5a1e5b3877
commit
918023496e
@ -370,7 +370,7 @@ private:
|
|||||||
std::vector<string_range> input_;
|
std::vector<string_range> input_;
|
||||||
std::string string_error_;
|
std::string string_error_;
|
||||||
bool bool_error_;
|
bool bool_error_;
|
||||||
enum error_mode error_mode_ { error_mode::String };
|
enum error_mode error_mode_ { error_mode::Bool };
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
|
@ -331,7 +331,7 @@ private:
|
|||||||
const std::string delim_;
|
const std::string delim_;
|
||||||
std::string string_error_;
|
std::string string_error_;
|
||||||
bool bool_error_;
|
bool bool_error_;
|
||||||
error_mode error_mode_{error_mode::String};
|
error_mode error_mode_{error_mode::Bool};
|
||||||
converter converter_;
|
converter converter_;
|
||||||
converter::split_input split_input_;
|
converter::split_input split_input_;
|
||||||
FILE* file_{nullptr};
|
FILE* file_{nullptr};
|
||||||
|
@ -328,10 +328,10 @@ TEST_CASE("testing error mode") {
|
|||||||
|
|
||||||
c.convert<int>("junk");
|
c.convert<int>("junk");
|
||||||
CHECK(!c.valid());
|
CHECK(!c.valid());
|
||||||
CHECK(!c.error_msg().empty());
|
CHECK(c.error_msg().empty());
|
||||||
|
|
||||||
c.set_error_mode(ss::error_mode::Bool);
|
c.set_error_mode(ss::error_mode::String);
|
||||||
c.convert<int>("junk");
|
c.convert<int>("junk");
|
||||||
CHECK(!c.valid());
|
CHECK(!c.valid());
|
||||||
CHECK(c.error_msg().empty());
|
CHECK(!c.error_msg().empty());
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,7 @@ TEST_CASE("testing composite conversion") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ss::parser p{f.name, ","};
|
ss::parser p{f.name, ","};
|
||||||
|
p.set_error_mode(ss::error_mode::String);
|
||||||
auto fail = [] { FAIL(""); };
|
auto fail = [] { FAIL(""); };
|
||||||
auto expect_error = [](auto error) { CHECK(!error.empty()); };
|
auto expect_error = [](auto error) { CHECK(!error.empty()); };
|
||||||
|
|
||||||
@ -452,12 +453,12 @@ TEST_CASE("testing error mode") {
|
|||||||
REQUIRE(!p.eof());
|
REQUIRE(!p.eof());
|
||||||
p.get_next<int>();
|
p.get_next<int>();
|
||||||
CHECK(!p.valid());
|
CHECK(!p.valid());
|
||||||
CHECK(!p.error_msg().empty());
|
CHECK(p.error_msg().empty());
|
||||||
|
|
||||||
p.set_error_mode(ss::error_mode::Bool);
|
p.set_error_mode(ss::error_mode::String);
|
||||||
|
|
||||||
REQUIRE(!p.eof());
|
REQUIRE(!p.eof());
|
||||||
p.get_next<int>();
|
p.get_next<int>();
|
||||||
CHECK(!p.valid());
|
CHECK(!p.valid());
|
||||||
CHECK(p.error_msg().empty());
|
CHECK(!p.error_msg().empty());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user