test: add test for multiple translation unit

This commit is contained in:
ToruNiina 2019-03-18 12:39:58 +09:00
parent 227688ec63
commit d5369c3429
3 changed files with 22 additions and 0 deletions

View File

@ -98,3 +98,8 @@ foreach(TEST_NAME ${TEST_NAMES})
) )
endif() endif()
endforeach(TEST_NAME) 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)

View 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);
}

View File

@ -0,0 +1,6 @@
#include <toml.hpp>
int read_a(const toml::table& t)
{
return toml::get<int>(t.at("a"));
}