commit
247ebd113a
|
@ -68,7 +68,7 @@ define(function(require) {
|
||||||
|
|
||||||
SUPER_NODE_ID: '00000000-0000-0000-0000-000000000000',
|
SUPER_NODE_ID: '00000000-0000-0000-0000-000000000000',
|
||||||
|
|
||||||
//Reserved FileDescriptors for streams
|
// Reserved File Descriptors for streams
|
||||||
STDIN: 0,
|
STDIN: 0,
|
||||||
STDOUT: 1,
|
STDOUT: 1,
|
||||||
STDERR: 2,
|
STDERR: 2,
|
||||||
|
|
|
@ -22,7 +22,7 @@ define(function(require) {
|
||||||
var STDIN = require('src/constants').STDIN;
|
var STDIN = require('src/constants').STDIN;
|
||||||
var STDOUT = require('src/constants').STDOUT;
|
var STDOUT = require('src/constants').STDOUT;
|
||||||
var STDERR = require('src/constants').STDERR;
|
var STDERR = require('src/constants').STDERR;
|
||||||
var FD = require('src/constants').FIRST_DESCRIPTOR;
|
var FIRST_DESCRIPTOR = require('src/constants').FIRST_DESCRIPTOR;
|
||||||
|
|
||||||
// The core fs operations live on impl
|
// The core fs operations live on impl
|
||||||
var impl = require('src/filesystem/implementation');
|
var impl = require('src/filesystem/implementation');
|
||||||
|
@ -82,12 +82,11 @@ define(function(require) {
|
||||||
fs.stdin = STDIN;
|
fs.stdin = STDIN;
|
||||||
fs.stdout = STDOUT;
|
fs.stdout = STDOUT;
|
||||||
fs.stderr = STDERR;
|
fs.stderr = STDERR;
|
||||||
fs.firstFD = FD;
|
|
||||||
|
|
||||||
// Safely expose the list of open files and file
|
// Safely expose the list of open files and file
|
||||||
// descriptor management functions
|
// descriptor management functions
|
||||||
var openFiles = {};
|
var openFiles = {};
|
||||||
var nextDescriptor = 3;
|
var nextDescriptor = FIRST_DESCRIPTOR;
|
||||||
Object.defineProperty(this, "openFiles", {
|
Object.defineProperty(this, "openFiles", {
|
||||||
get: function() { return openFiles; }
|
get: function() { return openFiles; }
|
||||||
});
|
});
|
||||||
|
|
|
@ -62,7 +62,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;
|
||||||
|
@ -79,6 +79,18 @@ 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 firstFD = require('src/constants').FIRST_DESCRIPTOR;
|
||||||
|
var fd1;
|
||||||
|
|
||||||
|
fs.open('/file1', 'w+', function(error, fd) {
|
||||||
|
if(error) throw error;
|
||||||
|
expect(fd).to.equal(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