Skip to content

Commit a289541

Browse files
committed
add readonly test
1 parent f671c94 commit a289541

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/basic.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,24 @@ test('pool', function (t) {
484484
})
485485
})
486486

487+
test('readonly mode', function (t) {
488+
t.plan(1)
489+
490+
const filename = gen()
491+
const f = new RAF(filename)
492+
493+
f.write(0, Buffer.from('hello world'), function () {
494+
f.close(function () {
495+
const r = new RAF(filename, { writable: false })
496+
497+
r.read(0, 5, function (_, data) {
498+
t.alike(data, Buffer.from('hello'))
499+
r.close()
500+
})
501+
})
502+
})
503+
})
504+
487505
function gen () {
488506
return path.join(tmp, ++i + '.txt')
489507
}

0 commit comments

Comments
 (0)