-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from vinniegarcia/multi-return
Support multiple return values via array, fixes #4
- Loading branch information
Showing
7 changed files
with
112 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
language: node_js | ||
node_js: | ||
- "0.12" | ||
- "0.11" | ||
- "0.10" | ||
- "iojs-v1.4.2" | ||
- "iojs-v2.3.3" | ||
install: npm i | ||
script: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
|
||
"parser": "babel-eslint", | ||
"env": { | ||
"browser": false, | ||
"es6": true, | ||
"node": true | ||
}, | ||
|
||
"rules": { | ||
"quotes": [2, "single"], | ||
"eol-last": [0], | ||
"no-mixed-requires": [0], | ||
"no-underscore-dangle": [0] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
|
||
"parser": "babel-eslint", | ||
"env": { | ||
"browser": false, | ||
"es6": true, | ||
"node": true, | ||
"mocha": true | ||
}, | ||
|
||
"rules": { | ||
"quotes": [2, "single"], | ||
"new-cap": false, | ||
"eol-last": [0], | ||
"no-mixed-requires": [0], | ||
"no-underscore-dangle": [0] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
|
||
import {ok} from 'assert'; | ||
import http from 'http'; | ||
import req from 'httpreq'; | ||
import {exec} from 'child_process'; | ||
import { h1, cool, fw } from './fixtures/emoji'; | ||
import Proposal from '../index'; | ||
|
||
describe(h1('multiple return values test'), () => { | ||
const handler = (req, res) => { | ||
res.writeHead(200); | ||
res.end(fw('TEST RESULT\n')); | ||
}, | ||
serv = http.createServer(handler); | ||
serv.on('listening', () => { | ||
console.log(fw('server listening')); | ||
}); | ||
|
||
before((done) => { | ||
serv.listen(8912); | ||
done(); | ||
}); | ||
|
||
after((done) => { | ||
serv.close(done); | ||
}); | ||
|
||
it(cool('returns one value, the response of a http get call'), (done) => { | ||
const getIt = Proposal(req.get); | ||
|
||
getIt('http://localhost:8912/').then((response) => { | ||
ok(!Array.isArray(response)); | ||
done(); | ||
}) | ||
.catch(done); | ||
}); | ||
|
||
it(cool('returns multiple values, the stdout and stderr from an executed child process'), | ||
async function (done) { | ||
this.timeout(10000); | ||
|
||
const futureExec = Proposal(exec); | ||
try { | ||
const [stout, sterr] = await futureExec('curl -# http://127.0.0.1:8912/', {}); | ||
ok(typeof stout === 'string' && typeof sterr === 'string'); | ||
done(); | ||
} catch (err) { | ||
done(err); | ||
} | ||
} | ||
); | ||
|
||
}); |