fw4: add support for configurable includes
[project/firewall4.git] / tests / lib / mocklib / fs.uc
index 10f30746819219d7cf31b8b70d81174a209abf30..61ad0b9dee88c5fc516dd95017cf85c489a7c80f 100644 (file)
@@ -5,7 +5,7 @@ return {
        readlink: function(path) {
                mocklib.trace_call("fs", "readlink", { path });
 
-               return path + "-link";
+               return path;
        },
 
        stat: function(path) {
@@ -151,6 +151,20 @@ return {
                return limit ? substr(mock, 0, limit) : mock;
        },
 
+       access: (fpath) => {
+               let path = sprintf("fs/open~%s.txt", replace(fpath, /[^A-Za-z0-9_-]+/g, '_')),
+                   mock = mocklib.read_data_file(path);
+
+               if (!mock) {
+                       mocklib.I("No stdout fixture defined for fs.access() path %s.", fpath);
+                       mocklib.I("Provide a mock output through the following text file:\n%s\n", path);
+
+                       return false;
+               }
+
+               return true;
+       },
+
        opendir: (path) => {
                let file = sprintf("fs/opendir~%s.json", replace(path, /[^A-Za-z0-9_-]+/g, '_')),
                    mock = mocklib.read_json_file(file),