fixes #77; also checked for error type to make sure the test passes for the correct reason (and not ENoEntry, for example)

This commit is contained in:
Alan Kligman 2013-12-14 15:14:44 -05:00
parent 52fb80f5e4
commit dac59f97b3
1 changed files with 15 additions and 18 deletions

View File

@ -194,36 +194,32 @@ define(["IDBFS"], function(IDBFS) {
var complete = false;
var _error, _result;
var that = this;
var nlinks = 11;
that.fs.open('/myfile', 'w', function(error, result) {
function createSymlinkChain(n, callback) {
if(n > nlinks) {
return callback();
}
that.fs.symlink('/myfile' + (n-1), '/myfile' + n, createSymlinkChain.bind(this, n+1, callback));
}
that.fs.open('/myfile0', 'w', function(error, result) {
if(error) throw error;
var fd = result;
that.fs.close(fd, function(error) {
if(error) throw error;
that.fs.stat('/myfile', function(error, result) {
that.fs.stat('/myfile0', function(error, result) {
if(error) throw error;
that.fs.symlink('/myfile', '/myfilelink1', function(error) {
if(error) throw error;
function createSymlinkChain(n) {
if(n>1) {
that.fs.symlink('/myfilelink' + (n-1), '/myfilelink' + n, function(error) {
if(error) throw error;
createSymlinkChain(n-1);
});
}
};
createSymlinkChain(11);
that.fs.stat('/myfilelink11', function(error, result) {
createSymlinkChain(1, function() {
that.fs.stat('/myfile11', function(error, result) {
_error = error;
_result = result;
complete = true;
});
});
});
});
});
@ -235,6 +231,7 @@ define(["IDBFS"], function(IDBFS) {
runs(function() {
expect(_result).not.toBeDefined();
expect(_error).toBeDefined();
expect(_error.name).toEqual('ELoop');
});
});