Skip to content

Commit cac9a30

Browse files
Add test
1 parent b591ff4 commit cac9a30

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

test/parallel/test-fs-stat.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,34 @@ fs.lstat(__filename, undefined, common.mustCall());
179179
]
180180
});
181181
}
182+
183+
// Stat Date properties can be set before reading them
184+
fs.stat(__filename, common.mustSucceed((s) => {
185+
s.atime = 2;
186+
s.mtime = 3;
187+
s.ctime = 4;
188+
s.birthtime = 5;
189+
190+
assert.strictEqual(s.atime, 2);
191+
assert.strictEqual(s.mtime, 3);
192+
assert.strictEqual(s.ctime, 4);
193+
assert.strictEqual(s.birthtime, 5);
194+
}));
195+
196+
// Stat Date properties can be set after reading them
197+
fs.stat(__filename, common.mustSucceed((s) => {
198+
s.atime;
199+
s.mtime;
200+
s.ctime;
201+
s.birthtime;
202+
203+
s.atime = 2;
204+
s.mtime = 3;
205+
s.ctime = 4;
206+
s.birthtime = 5;
207+
208+
assert.strictEqual(s.atime, 2);
209+
assert.strictEqual(s.mtime, 3);
210+
assert.strictEqual(s.ctime, 4);
211+
assert.strictEqual(s.birthtime, 5);
212+
}));

0 commit comments

Comments
 (0)