Corrected conflicting syntax and added testing clause for file descriptor argument value

This commit is contained in:
yoavgurevich 2014-05-14 16:02:46 -04:00
parent 382e59afd3
commit 6b2a023dea
2 changed files with 21 additions and 2 deletions

View File

@ -82,7 +82,7 @@ define(function(require) {
fs.stdin = STDIN;
fs.stdout = STDOUT;
fs.stderr = STDERR;
fs.firstFD = FD;
fs.firstFD = FIRST_DESCRIPTOR;
// Safely expose the list of open files and file
// descriptor management functions

View File

@ -58,7 +58,7 @@ define(["Filer", "util"], function(Filer, util) {
it('should return a unique file descriptor', function(done) {
var fs = util.fs();
var fd1
var fd1;
fs.open('/file1', 'w+', function(error, fd) {
if(error) throw error;
@ -75,6 +75,25 @@ define(["Filer", "util"], function(Filer, util) {
});
});
it('should return the argument value of the file descriptor index matching the value set by the first useable file descriptor constant', function(done) {
var fs = util.fs();
var openFileDescription = require('src/open-file-description');
fs.firstFD = require('src/constants').FIRST_DESCRIPTOR;
var fd1;
fs.open('/file1', 'w+', function(error, fd) {
if(error) throw error;
expect(error).not.to.exist;
expect(fd).to.be.a('number');
expect(fd).not.to.equal(fd1);
this.allocDescriptor = function(openFileDescription) {
expect(fd).to.equal(fs.firstFD);
};
done();
});
});
it('should create a new file when flagged for write', function(done) {
var fs = util.fs();