[libc-commits] [libc] [libc] Add struct group header and group line parser (PR #224208)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Thu Sep 17 08:51:59 PDT 2026
================
@@ -0,0 +1,191 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Unittests for parse_group_line.
+///
+//===----------------------------------------------------------------------===//
+
+#include "hdr/errno_macros.h"
+#include "hdr/types/gid_t.h"
+#include "hdr/types/size_t.h"
+#include "hdr/types/struct_group.h"
+#include "src/__support/CPP/span.h"
+#include "src/__support/pwd/flat_file_db.h"
+#include "src/grp/grp_utils.h"
+#include "test/UnitTest/Test.h"
+
+TEST(LlvmLibcGrpUtilsTest, ParseGroupLine_Success) {
+ char line[] = "wheel:x:10:root,admin,user1";
+ char *mem_ptrs[8];
+ struct group grp;
+ bool ok = LIBC_NAMESPACE::grp::parse_group_line(line, &grp, mem_ptrs);
+ ASSERT_TRUE(ok);
----------------
michaelrj-google wrote:
could use `ASSERT_THAT(... SUCCEEDS())`?
https://github.com/llvm/llvm-project/pull/224208
More information about the libc-commits
mailing list