================
@@ -88,6 +88,28 @@ TEST_P(SocketTest, DomainListenConnectAccept) {
   CreateDomainConnectedSockets(Path, &socket_a_up, &socket_b_up);
 }
 
+TEST_P(SocketTest, DomainListenGetListeningConnectionURI) {
+  llvm::SmallString<64> Path;
+  std::error_code EC =
+      llvm::sys::fs::createUniqueDirectory("DomainListenConnectAccept", Path);
+  ASSERT_FALSE(EC);
+  llvm::sys::path::append(Path, "test");
+
+  // Skip the test if the $TMPDIR is too long to hold a domain socket.
+  if (Path.size() > 107u)
+    return;
+
+  auto listen_socket_up = std::make_unique<DomainSocket>(
+      /*should_close=*/true);
+  Status error = listen_socket_up->Listen(Path, 5);
+  ASSERT_THAT_ERROR(error.ToError(), llvm::Succeeded());
+  ASSERT_TRUE(listen_socket_up->IsValid());
+
+  const auto &URIs = listen_socket_up->GetListeningConnectionURI();
+  ASSERT_EQ(URIs.size(), 1u);
+  ASSERT_EQ(URIs[0], llvm::formatv("unix-connect://{0}", Path).str());
----------------
labath wrote:

```suggestion
  ASSERT_THAT(URIs, testing::ElementsAre(llvm::formatv("unix-connect://{0}", 
Path).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

Reply via email to