mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-25 18:37:19 +00:00
fix tests on node v0.8
This commit is contained in:
parent
de2e373d75
commit
20fee047da
2 changed files with 5 additions and 1 deletions
|
|
@ -1,5 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.9"
|
||||
- "0.10"
|
||||
- "0.11"
|
||||
compiler: clang
|
||||
|
|
|
|||
|
|
@ -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', {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue