mirror of
https://github.com/ToruNiina/toml11.git
synced 2025-09-17 09:08:08 +08:00
test: add test to get a toml::value as string_view
This commit is contained in:
@@ -12,6 +12,9 @@
|
|||||||
#include <list>
|
#include <list>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
#include <string_view>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_get_exact)
|
BOOST_AUTO_TEST_CASE(test_get_exact)
|
||||||
@@ -166,6 +169,17 @@ BOOST_AUTO_TEST_CASE(test_get_string_type)
|
|||||||
toml::get<std::string>(v) += "bar";
|
toml::get<std::string>(v) += "bar";
|
||||||
BOOST_CHECK_EQUAL("foobar", toml::get<std::string>(v));
|
BOOST_CHECK_EQUAL("foobar", toml::get<std::string>(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __cplusplus >= 201703L
|
||||||
|
{
|
||||||
|
toml::value v("foo", toml::string_t::basic);
|
||||||
|
BOOST_CHECK_EQUAL("foo", toml::get<std::string_view>(v));
|
||||||
|
}
|
||||||
|
{
|
||||||
|
toml::value v("foo", toml::string_t::literal);
|
||||||
|
BOOST_CHECK_EQUAL("foo", toml::get<std::string_view>(v));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(test_get_toml_array)
|
BOOST_AUTO_TEST_CASE(test_get_toml_array)
|
||||||
|
Reference in New Issue
Block a user