================ @@ -225,12 +247,29 @@ TEST_P(SocketTest, TCPListen0GetPort) { if (!HostSupportsIPv4()) return; llvm::Expected<std::unique_ptr<TCPSocket>> sock = - Socket::TcpListen("10.10.12.3:0", false); + Socket::TcpListen("10.10.12.3:0", 5); ASSERT_THAT_EXPECTED(sock, llvm::Succeeded()); ASSERT_TRUE(sock.get()->IsValid()); EXPECT_NE(sock.get()->GetLocalPortNumber(), 0); } +TEST_P(SocketTest, TCPListen0GetListeningConnectionURI) { + if (!HostSupportsProtocol()) + return; + + std::string addr = llvm::formatv("[{0}]:0", GetParam().localhost_ip).str(); + llvm::Expected<std::unique_ptr<TCPSocket>> sock = Socket::TcpListen(addr); + ASSERT_THAT_EXPECTED(sock, llvm::Succeeded()); + ASSERT_TRUE(sock.get()->IsValid()); + + for (const auto &URI : sock.get()->GetListeningConnectionURI()) { + EXPECT_EQ(URI, + llvm::formatv("connection://[{0}]:{1}", GetParam().localhost_ip, + sock->get()->GetLocalPortNumber()) + .str()); + } +} ---------------- labath wrote:
```suggestion EXPECT_THAT(sock.get()->GetListeningConnectionURI(), testing::ElementsAre(llvm::formatv("connection://[{0}]:{1}", GetParam().localhost_ip, sock->get()->GetLocalPortNumber()) .str())); ``` https://github.com/llvm/llvm-project/pull/118330 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits