2014-05-23 20:53:50 +00:00
|
|
|
var Filer = require('../..');
|
|
|
|
var util = require('../lib/test-utils.js');
|
|
|
|
var expect = require('chai').expect;
|
|
|
|
|
|
|
|
describe('fs.xattr', function() {
|
|
|
|
beforeEach(util.setup);
|
|
|
|
afterEach(util.cleanup);
|
|
|
|
|
|
|
|
it('should be a function', function () {
|
|
|
|
var fs = util.fs();
|
|
|
|
expect(fs.setxattr).to.be.a('function');
|
|
|
|
expect(fs.getxattr).to.be.a('function');
|
|
|
|
expect(fs.removexattr).to.be.a('function');
|
|
|
|
expect(fs.fsetxattr).to.be.a('function');
|
|
|
|
expect(fs.fgetxattr).to.be.a('function');
|
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when setting with a name that is not a string', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 89, 'testvalue', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EINVAL');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when setting with a name that is null', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', null, 'testvalue', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EINVAL');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when setting with an invalid flag', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', 'InvalidFlag', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EINVAL');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when when setting an extended attribute which exists with XATTR_CREATE flag', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'othervalue', 'CREATE', function(error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EEXIST');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when setting an extended attribute which does not exist with XATTR_REPLACE flag', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', 'REPLACE', function(error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('ENOATTR');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when getting an attribute with a name that is empty', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', '', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EINVAL');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when getting an attribute where the name is not a string', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-21 21:30:40 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 89, function(error, value) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EINVAL');
|
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when getting an attribute that does not exist', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('ENOATTR');
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when file descriptor is invalid', function(done) {
|
|
|
|
var fs = util.fs();
|
|
|
|
var completeSet, completeGet, completeRemove;
|
|
|
|
var _value;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
completeSet = completeGet = completeRemove = false;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
function maybeDone() {
|
|
|
|
if(completeSet && completeGet && completeRemove) {
|
|
|
|
done();
|
2014-01-21 21:25:09 +00:00
|
|
|
}
|
2014-05-23 20:53:50 +00:00
|
|
|
}
|
2014-01-21 21:25:09 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fsetxattr(1, 'test', 'value', function(error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EBADF');
|
|
|
|
completeSet = true;
|
|
|
|
maybeDone();
|
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fgetxattr(1, 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EBADF');
|
|
|
|
expect(value).not.to.exist;
|
|
|
|
completeGet = true;
|
|
|
|
maybeDone();
|
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fremovexattr(1, 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('EBADF');
|
|
|
|
completeRemove = true;
|
|
|
|
maybeDone();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should set and get an extended attribute of a path', function(done) {
|
|
|
|
var fs = util.fs();
|
|
|
|
var name = 'test';
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', name, 'somevalue', function(error) {
|
|
|
|
expect(error).not.to.exist;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', name, function(error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.equal('somevalue');
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should error when attempting to remove a non-existing attribute', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.removexattr('/testfile', 'testenoattr', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('ENOATTR');
|
|
|
|
done();
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should set and get an empty string as a value', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', '', function (error) {
|
|
|
|
if(error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.equal('');
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should set and get an extended attribute for a valid file descriptor', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.open('/testfile', 'w', function (error, ofd) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fsetxattr(ofd, 'test', 'value', function (error) {
|
|
|
|
expect(error).not.to.exist;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fgetxattr(ofd, 'test', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.equal('value');
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should set and get an object to an extended attribute', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', { key1: 'test', key2: 'value', key3: 87 }, function (error) {
|
|
|
|
if(error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.deep.equal({ key1: 'test', key2: 'value', key3: 87 });
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should update/overwrite an existing extended attribute', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
2014-01-21 21:25:09 +00:00
|
|
|
if (error) throw error;
|
2014-05-23 20:53:50 +00:00
|
|
|
expect(value).to.equal('value');
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', { o: 'object', t: 'test' }, function (error) {
|
2014-01-21 21:25:09 +00:00
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
2014-01-21 21:25:09 +00:00
|
|
|
if (error) throw error;
|
2014-05-23 20:53:50 +00:00
|
|
|
expect(value).to.deep.equal({ o: 'object', t: 'test' });
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 100, 'REPLACE', function (error) {
|
2014-01-21 21:25:09 +00:00
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(value).to.equal(100);
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
|
|
|
})
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should set multiple extended attributes for a path', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
|
|
|
|
|
|
|
fs.setxattr('/testfile', 'test', 89, function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'other', 'attribute', function (error) {
|
|
|
|
if(error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
2014-01-21 21:25:09 +00:00
|
|
|
if(error) throw error;
|
2014-05-23 20:53:50 +00:00
|
|
|
expect(value).to.equal(89);
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'other', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.equal('attribute');
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should remove an extended attribute from a path', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
|
|
|
|
|
|
|
fs.setxattr('/testfile', 'test', 'somevalue', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
2014-05-23 20:53:50 +00:00
|
|
|
expect(value).to.equal('somevalue');
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.removexattr('/testfile', 'test', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('ENOATTR');
|
|
|
|
done();
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-01-02 22:50:26 +00:00
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2014-01-02 22:50:26 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should remove an extended attribute from a valid file descriptor', function(done) {
|
|
|
|
var fs = util.fs();
|
2014-01-02 22:50:26 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.open('/testfile', 'w', function (error, ofd) {
|
|
|
|
if (error) throw error;
|
|
|
|
|
|
|
|
fs.fsetxattr(ofd, 'test', 'somevalue', function (error) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fgetxattr(ofd, 'test', function (error, value) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
2014-05-23 20:53:50 +00:00
|
|
|
expect(value).to.equal('somevalue');
|
2014-01-02 22:50:26 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fremovexattr(ofd, 'test', function (error) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.fgetxattr(ofd, 'test', function (error) {
|
|
|
|
expect(error).to.exist;
|
|
|
|
expect(error.code).to.equal('ENOATTR');
|
|
|
|
done();
|
2014-01-02 22:50:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
2014-05-23 20:53:50 +00:00
|
|
|
});
|
2014-01-05 17:22:57 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
it('should allow setting with a null value', function(done) {
|
|
|
|
var fs = util.fs();
|
2014-01-05 17:22:57 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
|
|
|
if (error) throw error;
|
2014-01-05 17:22:57 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.setxattr('/testfile', 'test', null, function (error) {
|
|
|
|
if (error) throw error;
|
2014-01-05 17:22:57 +00:00
|
|
|
|
2014-05-23 20:53:50 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.be.null;
|
|
|
|
done();
|
2014-01-05 17:22:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-20 16:50:59 +00:00
|
|
|
});
|
2014-01-21 21:25:09 +00:00
|
|
|
});
|