feat add inja

This commit is contained in:
tqcq 2024-01-05 09:42:29 +08:00
parent f15f564b37
commit a9e041dca6
5 changed files with 28070 additions and 1 deletions

3288
3party/inja/inja.hpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,11 @@ target_sources(${PROJECT_NAME} PRIVATE
)
target_link_libraries(${PROJECT_NAME} PUBLIC fmt::fmt jsoncpp_static)
target_compile_definitions(${PROJECT_NAME} PRIVATE ULIB_LIBRARY_IMPL)
target_include_directories(${PROJECT_NAME} PUBLIC src)
target_include_directories(${PROJECT_NAME} PUBLIC
3party/nlohmann
3party/inja
src
)
install(TARGETS ${PROJECT_NAME} DESTINATION lib)

View File

@ -0,0 +1,11 @@
#include <gtest/gtest.h>
#include <inja.hpp>
TEST(inja, base)
{
inja::json data;
data["name"] = "world";
std::string str = inja::render("Hello {{ name }}", data);
EXPECT_EQ(str, "Hello world");
}

View File

@ -10,6 +10,7 @@ add_executable(ulib_test
ulib/system/thread_unittest.cpp
ulib/system/thread_pool_unittest.cpp
ulib/system/timer_unittest.cpp
3party/inja/inja_unittest.cpp
)
target_link_libraries(ulib_test PRIVATE
ulib