mirror of
https://github.com/ToruNiina/toml11.git
synced 2024-11-09 14:20:06 +00:00
test: add test for multiple translation unit
This commit is contained in:
parent
227688ec63
commit
d5369c3429
@ -98,3 +98,8 @@ foreach(TEST_NAME ${TEST_NAMES})
|
||||
)
|
||||
endif()
|
||||
endforeach(TEST_NAME)
|
||||
|
||||
# this test is to check it compiles. it will not run
|
||||
add_executable(test_multiple_translation_unit
|
||||
test_multiple_translation_unit_1.cpp
|
||||
test_multiple_translation_unit_2.cpp)
|
||||
|
11
tests/test_multiple_translation_unit_1.cpp
Normal file
11
tests/test_multiple_translation_unit_1.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <toml.hpp>
|
||||
|
||||
int read_a(const toml::table&);
|
||||
|
||||
int main()
|
||||
{
|
||||
const std::string content("a = 0");
|
||||
std::istringstream iss(content);
|
||||
const auto data = toml::parse(iss, "test_multiple_translation_unit.toml");
|
||||
return read_a(data);
|
||||
}
|
6
tests/test_multiple_translation_unit_2.cpp
Normal file
6
tests/test_multiple_translation_unit_2.cpp
Normal file
@ -0,0 +1,6 @@
|
||||
#include <toml.hpp>
|
||||
|
||||
int read_a(const toml::table& t)
|
||||
{
|
||||
return toml::get<int>(t.at("a"));
|
||||
}
|
Loading…
Reference in New Issue
Block a user