tomlplusplus/tests/parsing_booleans.cpp
Mark Gillard c7483cb92c added insertion operations for tables and arrays
also:
- fixed column numbers being wrong when a value ended at EOF
- fixed some `print_to_stream` overloads for `char8_t`
- fixed a minor preprocessor snafu on MSVC
- fixed '\' not being escaped when printing string values
- added an initializer list constructor for tables
- added `array::flatten`
- added `table::find`
- added `table::is_inline` setter
- added `TOML_SMALL_INT_TYPE`
- added `parse_file`
- added stream operator for source_region
- added proper license notice for the utf8 decoder
- added lots more documentation and tests
2020-02-13 20:34:45 +02:00

28 lines
605 B
C++

#include "tests.h"
TEST_CASE("parsing - booleans")
{
parsing_should_succeed(S(R"(
bool1 = true
bool2 = false
)"sv),
[](table&& tbl) noexcept
{
CHECK(tbl[S("bool1")] == true);
CHECK(tbl[S("bool2")] == false);
}
);
// "Always lowercase."
parsing_should_fail(S("bool = True"sv));
parsing_should_fail(S("bool = TRUE"sv));
parsing_should_fail(S("bool = tRUE"sv));
parsing_should_fail(S("bool = False"sv));
parsing_should_fail(S("bool = FALSE"sv));
parsing_should_fail(S("bool = fALSE"sv));
// value tests
parse_expected_value(" true", true);
parse_expected_value("false", false);
}