mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 17:28:29 +00:00
Fixed #48
This commit is contained in:
parent
7d6df0c651
commit
b6df220b55
2 changed files with 47 additions and 9 deletions
34
test/test.cc
34
test/test.cc
|
@ -835,6 +835,40 @@ TEST_F(ServerTestWithAI_PASSIVE, GetMethod200)
|
|||
EXPECT_EQ("Hello World!", res->body);
|
||||
}
|
||||
|
||||
class ServerUpDownTest : public ::testing::Test {
|
||||
protected:
|
||||
ServerUpDownTest()
|
||||
: cli_(HOST, PORT)
|
||||
{}
|
||||
|
||||
virtual void SetUp() {
|
||||
t_ = thread([&](){
|
||||
svr_.bind_to_any_port(HOST);
|
||||
msleep(500);
|
||||
svr_.listen_after_bind();
|
||||
});
|
||||
|
||||
while (!svr_.is_running()) {
|
||||
msleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void TearDown() {
|
||||
svr_.stop();
|
||||
t_.join();
|
||||
}
|
||||
|
||||
Client cli_;
|
||||
Server svr_;
|
||||
thread t_;
|
||||
};
|
||||
|
||||
TEST_F(ServerUpDownTest, QuickStartStop)
|
||||
{
|
||||
// Should not crash, especially when run with
|
||||
// --gtest_filter=ServerUpDownTest.QuickStartStop --gtest_repeat=1000
|
||||
}
|
||||
|
||||
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
|
||||
TEST(SSLClientTest, ServerNameIndication)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue