From 7782017c19071f19419c10cc1d740515f6bf3bf8 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 9 May 2022 10:49:43 +0200 Subject: [PATCH] tests: fix mocked `fd.read("line")` api Signed-off-by: Jo-Philipp Wich --- tests/lib/mocklib/fs.uc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lib/mocklib/fs.uc b/tests/lib/mocklib/fs.uc index 6e26552..3cb6252 100644 --- a/tests/lib/mocklib/fs.uc +++ b/tests/lib/mocklib/fs.uc @@ -110,9 +110,9 @@ return { case "line": let i = index(mock, "\n"); - i = (i > -1) ? i + 1 : mock.length; + i = (i > -1) ? i + 1 : length(mock); rv = substr(mock, 0, i); - mock = substr(mock, i); + mock = length(mock) ? substr(mock, i) : null; break; default: -- 2.30.2