tests: fix mocked `fd.read("line")` api
authorJo-Philipp Wich <jo@mein.io>
Mon, 9 May 2022 08:49:43 +0000 (10:49 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 9 May 2022 08:49:43 +0000 (10:49 +0200)
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
tests/lib/mocklib/fs.uc

index 6e2655274017be2570bcee93ca2944cddc15394b..3cb6252a777f231a465b7fea1f4ecd57cc92abe2 100644 (file)
@@ -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: