commit fc3fb4be417fe55920469ebef2ad0a2f41e8b732
parent fd2e2bde1935c6a74b9573a51f349c55e655e302
Author: Armin Preiml <apreiml@strohwolke.at>
Date: Sat, 21 Dec 2024 14:39:16 +0100
unix::passwd: fix test examples
bufio drops the last line since EOF_DISCARD is the default mode.
Signed-off-by: Armin Preiml <apreiml@strohwolke.at>
Diffstat:
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/unix/passwd/group.ha b/unix/passwd/group.ha
@@ -188,7 +188,7 @@ export fn getgroups(name: str) []grent = {
const buf = memio::fixed(strings::toutf8(
"root:x:0:root\n"
"mail:x:12:\n"
- "video:x:986:alex,wmuser"));
+ "video:x:986:alex,wmuser\n"));
const rd = groups_read(&buf);
defer groups_finish(&rd);
@@ -221,4 +221,5 @@ export fn getgroups(name: str) []grent = {
assert(ent.gid == expect[i].gid);
assert(ent.userlist == expect[i].userlist);
};
+ assert(i == len(expect));
};
diff --git a/unix/passwd/passwd.ha b/unix/passwd/passwd.ha
@@ -166,7 +166,7 @@ export fn getuid(uid: unix::uid) (pwent | void) = {
@test fn nextpw() void = {
const buf = memio::fixed(strings::toutf8(
"sircmpwn:x:1000:1000:sircmpwn's comment:/home/sircmpwn:/bin/rc\n"
- "alex:x:1001:1001::/home/alex:/bin/zsh"));
+ "alex:x:1001:1001::/home/alex:/bin/zsh\n"));
const rd = users_read(&buf);
defer users_finish(&rd);
@@ -203,4 +203,6 @@ export fn getuid(uid: unix::uid) (pwent | void) = {
assert(ent.homedir == expect[i].homedir);
assert(ent.shell == expect[i].shell);
};
+
+ assert(i == len(expect));
};