소스 검색

Added a unit test

yhirose 5 년 전
부모
커밋
15c4106a36
1개의 변경된 파일14개의 추가작업 그리고 0개의 파일을 삭제
  1. 14 0
      test/test.cc

+ 14 - 0
test/test.cc

@@ -394,6 +394,20 @@ TEST(ConnectionErrorTest, InvalidHost) {
   ASSERT_TRUE(res == nullptr);
 }
 
+TEST(ConnectionErrorTest, InvalidHost2) {
+  auto host = "httpbin.org/";
+
+#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
+  httplib::SSLClient cli(host);
+#else
+  httplib::Client cli(host);
+#endif
+  cli.set_connection_timeout(2);
+
+  auto res = cli.Get("/");
+  ASSERT_TRUE(res == nullptr);
+}
+
 TEST(ConnectionErrorTest, InvalidPort) {
   auto host = "localhost";