1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2026-03-02 03:40:15 +00:00

Standardized

This commit is contained in:
Andrew Osheroff
2019-07-16 13:46:43 +02:00
parent 8fb3334d7a
commit b9d24f6812
5 changed files with 20 additions and 15 deletions

View File

@@ -16,9 +16,9 @@ tape('readlink', function (t) {
cb(0, 'hello')
},
getattr: function (path, cb) {
if (path === '/') return cb(null, stat({mode: 'dir', size: 4096}))
if (path === '/hello') return cb(null, stat({mode: 'file', size: 11}))
if (path === '/link') return cb(null, stat({mode: 'link', size: 5}))
if (path === '/') return cb(null, stat({ mode: 'dir', size: 4096 }))
if (path === '/hello') return cb(null, stat({ mode: 'file', size: 11 }))
if (path === '/link') return cb(null, stat({ mode: 'link', size: 5 }))
return cb(fuse.ENOENT)
},
open: function (path, flags, cb) {

View File

@@ -3,7 +3,7 @@ var fuse = require('../')
var tape = require('tape')
tape('mount', function (t) {
fuse.mount(mnt, {force: true}, function (err) {
fuse.mount(mnt, { force: true }, function (err) {
t.error(err, 'no error')
t.ok(true, 'works')
fuse.unmount(mnt, function () {
@@ -13,11 +13,11 @@ tape('mount', function (t) {
})
tape('mount + unmount + mount', function (t) {
fuse.mount(mnt, {force: true}, function (err) {
fuse.mount(mnt, { force: true }, function (err) {
t.error(err, 'no error')
t.ok(true, 'works')
fuse.unmount(mnt, function () {
fuse.mount(mnt, {force: true}, function (err) {
fuse.mount(mnt, { force: true }, function (err) {
t.error(err, 'no error')
t.ok(true, 'works')
fuse.unmount(mnt, function () {

View File

@@ -14,8 +14,8 @@ tape('read', function (t) {
return cb(fuse.ENOENT)
},
getattr: function (path, cb) {
if (path === '/') return cb(null, stat({mode: 'dir', size: 4096}))
if (path === '/test') return cb(null, stat({mode: 'file', size: 11}))
if (path === '/') return cb(null, stat({ mode: 'dir', size: 4096 }))
if (path === '/test') return cb(null, stat({ mode: 'file', size: 11 }))
return cb(fuse.ENOENT)
},
open: function (path, flags, cb) {
@@ -44,10 +44,10 @@ tape('read', function (t) {
t.error(err, 'no error')
t.same(buf, new Buffer('hello world'), 'read file again')
fs.createReadStream(path.join(mnt, 'test'), {start: 0, end: 4}).pipe(concat(function (buf) {
fs.createReadStream(path.join(mnt, 'test'), { start: 0, end: 4 }).pipe(concat(function (buf) {
t.same(buf, new Buffer('hello'), 'partial read file')
fs.createReadStream(path.join(mnt, 'test'), {start: 6, end: 10}).pipe(concat(function (buf) {
fs.createReadStream(path.join(mnt, 'test'), { start: 6, end: 10 }).pipe(concat(function (buf) {
t.same(buf, new Buffer('world'), 'partial read file + start offset')
fuse.unmount(mnt, function () {

View File

@@ -20,8 +20,8 @@ tape('write', function (t) {
cb(0)
},
getattr: function (path, cb) {
if (path === '/') return cb(null, stat({mode: 'dir', size: 4096}))
if (path === '/hello' && created) return cb(null, stat({mode: 'file', size: size}))
if (path === '/') return cb(null, stat({ mode: 'dir', size: 4096 }))
if (path === '/hello' && created) return cb(null, stat({ mode: 'file', size: size }))
return cb(fuse.ENOENT)
},
create: function (path, flags, cb) {