fix tests on node v0.8

This commit is contained in:
Francis Gulotta 2014-01-23 20:46:26 -05:00
parent de2e373d75
commit 20fee047da
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,7 @@
language: node_js
node_js:
- "0.8"
- "0.9"
- "0.10"
- "0.11"
compiler: clang

View file

@ -130,6 +130,9 @@ Hardware.prototype.fakeRead = function (path, buffer, offset, length, position,
if ((offset + length) > buffer.length) {
throw new Error("Length extends beyond buffer");
}
// node v0.8 doesn't like a slice that is bigger then available data
length = port.data.length < length ? port.data.length : length;
var read = port.data.slice(0, length);
port.data = port.data.slice(length);
read.copy(buffer, offset);
@ -138,7 +141,6 @@ Hardware.prototype.fakeRead = function (path, buffer, offset, length, position,
var hardware = new Hardware();
var SandboxedModule = require('sandboxed-module');
var serialPort = SandboxedModule.require('../serialport', {