update doc to fit latest update

marty1885 2021-07-17 15:17:40 +08:00
parent a6127dd62e
commit a6911603cf
2 changed files with 12 additions and 12 deletions

@ -148,7 +148,7 @@ int main()
// Start the main loop on another thread
std::thread thr([&]() {
// Queues the promis to be fulfilled after starting the loop
app().getLoop()->queueInLoop([]() { p1.set_value(); });
app().getLoop()->queueInLoop([&p1]() { p1.set_value(); });
app().run();
});
@ -165,13 +165,13 @@ int main()
### CMake 集成
与大多数测试框架一样DrgonTest 可以将自身集成到 CMake 中。 `ParseAndAddDrogonTest` 函数将它在源文件中看到的测试添加到 CMake 的 CTest 框架中。
与大多数测试框架一样DrgonTest 可以将自身集成到 CMake 中。 `ParseAndAddDrogonTests` 函数将它在源文件中看到的测试添加到 CMake 的 CTest 框架中。
```cmake
include(ParseAndAddDrogonTest)
include(ParseAndAddDrogonTest) # Also loads ParseAndAddDrogonTests
add_executable(mytest main.cpp)
target_link_libraries(mytest PRIVATE drogon)
ParseAndAddDrogonTest(mytest)
target_link_libraries(mytest PRIVATE Drogon::Drogon)
ParseAndAddDrogonTests(mytest)
```
现在可以通过构建系统(在本例中为 Makefile运行测试。

@ -148,7 +148,7 @@ int main()
// Start the main loop on another thread
std::thread thr([&]() {
// Queues the promis to be fulfilled after starting the loop
app().getLoop()->queueInLoop([]() { p1.set_value(); });
app().getLoop()->queueInLoop([&p1]() { p1.set_value(); });
app().run();
});
@ -165,13 +165,13 @@ int main()
### CMake integration
Like most testing frmaeworks, DrogonTest can integrate itself into CMake. The `ParseAndAddDrogonTest` function adds tests it sees in the source file to CMake's CTest framework.
Like most testing frmaeworks, DrogonTest can integrate itself into CMake. The `ParseAndAddDrogonTests` function adds tests it sees in the source file to CMake's CTest framework.
```cmake
include(ParseAndAddDrogonTest)
find_package(Drogon REQUIRED) # also loads ParseAndAddDrogonTests
add_executable(mytest main.cpp)
target_link_libraries(mytest PRIVATE drogon)
ParseAndAddDrogonTest(mytest)
target_link_libraries(mytest PRIVATE Drogon::Drogon)
ParseAndAddDrogonTests(mytest)
```
Now the test could be ran through build system (Makefile in this case).