initial
This commit is contained in:
37
node_modules/onoff/test/output-with-edge-bug.js
generated
vendored
Normal file
37
node_modules/onoff/test/output-with-edge-bug.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
// Test for https://github.com/fivdi/onoff/issues/87
|
||||
//
|
||||
// If a Gpio is instantiated for an output GPIO and the edge parameter is
|
||||
// specified then the edge parameter should be ignored. Attempting to write
|
||||
// the sysfs edge file for an output GPIO results in an
|
||||
// "EIO: i/o error, write"
|
||||
|
||||
const Gpio = require('../onoff').Gpio;
|
||||
const assert = require('assert');
|
||||
|
||||
function ensureGpio17Unexported(cb) {
|
||||
let led = new Gpio(17, 'out');
|
||||
|
||||
led.unexport();
|
||||
|
||||
setTimeout(() => {
|
||||
cb();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
ensureGpio17Unexported(() => {
|
||||
let led;
|
||||
|
||||
assert.doesNotThrow(
|
||||
() => {
|
||||
led = new Gpio(17, 'out', 'both');
|
||||
},
|
||||
'can\'t instantiate a Gpio for an output with edge option specified'
|
||||
);
|
||||
|
||||
led.unexport();
|
||||
|
||||
console.log('ok - ' + __filename);
|
||||
});
|
||||
|
Reference in New Issue
Block a user