2014-01-21 21:25:09 +00:00
|
|
|
define(["Filer", "util"], function(Filer, util) {
|
2013-12-20 16:50:59 +00:00
|
|
|
|
2013-12-21 21:30:40 +00:00
|
|
|
describe('fs.xattr', function() {
|
2014-01-21 21:25:09 +00:00
|
|
|
beforeEach(util.setup);
|
|
|
|
afterEach(util.cleanup);
|
2013-12-20 16:50:59 +00:00
|
|
|
|
2013-12-21 21:30:40 +00:00
|
|
|
it('should be a function', function () {
|
2014-01-21 21:25:09 +00:00
|
|
|
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-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 89, 'testvalue', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EINVAL');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', null, 'testvalue', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EINVAL');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', 'InvalidFlag', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EINVAL');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', function(error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'othervalue', 'CREATE', function(error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EEXIST');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', 'REPLACE', function(error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-12 20:23:03 +00:00
|
|
|
expect(error.code).to.equal('ENOATTR');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', '', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EINVAL');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
2013-12-21 21:30:40 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 89, function(error, value) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EINVAL');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-21 21:30:40 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function(error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
2014-03-12 20:23:03 +00:00
|
|
|
expect(error.code).to.equal('ENOATTR');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
it('should error when file descriptor is invalid', function(done) {
|
|
|
|
var fs = util.fs();
|
2014-01-02 22:50:26 +00:00
|
|
|
var completeSet, completeGet, completeRemove;
|
2013-12-23 01:58:00 +00:00
|
|
|
var _value;
|
|
|
|
|
2014-01-02 22:50:26 +00:00
|
|
|
completeSet = completeGet = completeRemove = false;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
function maybeDone() {
|
|
|
|
if(completeSet && completeGet && completeRemove) {
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fs.fsetxattr(1, 'test', 'value', function(error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EBADF');
|
2013-12-23 01:58:00 +00:00
|
|
|
completeSet = true;
|
2014-01-21 21:25:09 +00:00
|
|
|
maybeDone();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fgetxattr(1, 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EBADF');
|
2014-01-21 21:25:09 +00:00
|
|
|
expect(value).not.to.exist;
|
2013-12-23 01:58:00 +00:00
|
|
|
completeGet = true;
|
2014-01-21 21:25:09 +00:00
|
|
|
maybeDone();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fremovexattr(1, 'test', function(error, value) {
|
|
|
|
expect(error).to.exist;
|
2014-03-05 19:28:31 +00:00
|
|
|
expect(error.code).to.equal('EBADF');
|
2014-01-02 22:50:26 +00:00
|
|
|
completeRemove = true;
|
2014-01-21 21:25:09 +00:00
|
|
|
maybeDone();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
it('should set and get an extended attribute of a path', function(done) {
|
|
|
|
var fs = util.fs();
|
2013-12-23 01:58:00 +00:00
|
|
|
var name = 'test';
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', name, 'somevalue', function(error) {
|
|
|
|
expect(error).not.to.exist;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', '', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.removexattr('/testfile', 'testenoattr', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-12 20:23:03 +00:00
|
|
|
expect(error.code).to.equal('ENOATTR');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', '', function (error) {
|
|
|
|
if(error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.open('/testfile', 'w', function (error, ofd) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fsetxattr(ofd, 'test', 'value', function (error) {
|
|
|
|
expect(error).not.to.exist;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +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-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'value', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
if (error) throw error;
|
|
|
|
expect(value).to.equal('value');
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', { o: 'object', t: 'test' }, function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
if (error) throw error;
|
|
|
|
expect(value).to.deep.equal({ o: 'object', t: 'test' });
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 100, 'REPLACE', function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(value).to.equal(100);
|
|
|
|
done();
|
2013-12-23 01:58:00 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-23 01:58:00 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 89, function (error) {
|
|
|
|
if (error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'other', 'attribute', function (error) {
|
|
|
|
if(error) throw error;
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
if(error) throw error;
|
|
|
|
expect(value).to.equal(89);
|
2013-12-23 01:58:00 +00:00
|
|
|
|
2014-01-21 21:25:09 +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
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', 'somevalue', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
2014-01-21 21:25:09 +00:00
|
|
|
expect(value).to.equal('somevalue');
|
2013-12-24 20:10:17 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.removexattr('/testfile', 'test', function (error) {
|
2013-12-24 20:10:17 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-12 20:23:03 +00:00
|
|
|
expect(error.code).to.equal('ENOATTR');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2014-01-02 22:50:26 +00:00
|
|
|
});
|
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.open('/testfile', 'w', function (error, ofd) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fsetxattr(ofd, 'test', 'somevalue', function (error) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fgetxattr(ofd, 'test', function (error, value) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
2014-01-21 21:25:09 +00:00
|
|
|
expect(value).to.equal('somevalue');
|
2014-01-02 22:50:26 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fremovexattr(ofd, 'test', function (error) {
|
2014-01-02 22:50:26 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.fgetxattr(ofd, 'test', function (error) {
|
|
|
|
expect(error).to.exist;
|
2014-03-12 20:23:03 +00:00
|
|
|
expect(error.code).to.equal('ENOATTR');
|
2014-01-21 21:25:09 +00:00
|
|
|
done();
|
2014-01-02 22:50:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-24 20:10:17 +00:00
|
|
|
});
|
2014-01-05 17:22:57 +00:00
|
|
|
|
2014-01-21 21:25:09 +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-01-21 21:25:09 +00:00
|
|
|
fs.writeFile('/testfile', '', function (error) {
|
2014-01-05 17:22:57 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.setxattr('/testfile', 'test', null, function (error) {
|
2014-01-05 17:22:57 +00:00
|
|
|
if (error) throw error;
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
fs.getxattr('/testfile', 'test', function (error, value) {
|
|
|
|
expect(error).not.to.exist;
|
|
|
|
expect(value).to.be.null;
|
|
|
|
done();
|
2014-01-14 19:50:20 +00:00
|
|
|
});
|
2014-01-05 17:22:57 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2013-12-20 16:50:59 +00:00
|
|
|
});
|
2014-01-21 21:25:09 +00:00
|
|
|
});
|