Corrected conflicting syntax and added testing clause for file descriptor argument value
This commit is contained in:
parent
382e59afd3
commit
6b2a023dea
|
@ -82,7 +82,7 @@ define(function(require) {
|
||||||
fs.stdin = STDIN;
|
fs.stdin = STDIN;
|
||||||
fs.stdout = STDOUT;
|
fs.stdout = STDOUT;
|
||||||
fs.stderr = STDERR;
|
fs.stderr = STDERR;
|
||||||
fs.firstFD = FD;
|
fs.firstFD = FIRST_DESCRIPTOR;
|
||||||
|
|
||||||
// Safely expose the list of open files and file
|
// Safely expose the list of open files and file
|
||||||
// descriptor management functions
|
// descriptor management functions
|
||||||
|
|
|
@ -58,7 +58,7 @@ define(["Filer", "util"], function(Filer, util) {
|
||||||
|
|
||||||
it('should return a unique file descriptor', function(done) {
|
it('should return a unique file descriptor', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
var fd1
|
var fd1;
|
||||||
|
|
||||||
fs.open('/file1', 'w+', function(error, fd) {
|
fs.open('/file1', 'w+', function(error, fd) {
|
||||||
if(error) throw error;
|
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) {
|
it('should create a new file when flagged for write', function(done) {
|
||||||
var fs = util.fs();
|
var fs = util.fs();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue