/**
 * async-exec-cmd <https://github.com/tunnckoCore/async-exec-cmd>
 *
 * Copyright (c) 2015 Charlike Mike Reagent, contributors.
 * Released under the MIT license.
 */

'use strict';

var assert = require('assert');
var asyncExecCmd = require('./index');

// should be tested and should work:
// asyncExecCmd('npm help', function() {})
// asyncExecCmd('npm install --save-dev bluebird', function() {})
// asyncExecCmd('npm ls', {stdio: 'inherit'}, function() {})
// asyncExecCmd('npm', ['install', 'semver'], function() {})
// asyncExecCmd('echo', ['hello world'], {stdio: 'inherit'}, function() {})
// asyncExecCmd('npm i lodash', 'invalid second arg', {stdio: 'inherit'}, function() {})
// asyncExecCmd('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid', function() {})
//
// should throw: "should have `callback` and expects to be function":
// asyncExecCmd('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid')
// asyncExecCmd('gitclone tunnckoCore/octet#master', {})
//
// should throw "should have at least two arguments":
// asyncExecCmd('npm i --save-dev mocha')
//
// should throw "expect `cmd` be string"
// asyncExecCmd({})

@@ -330,79 +330,319 @@
 ion(
-) %7B%7D)%0A// asyncExecCmd('npm install --save-dev bluebird', function() %7B%7D)
+err, res) %7B%0A//   if (err) return console.log(err);%0A//   console.log('npm help');%0A// %7D) //=%3E work%0A// asyncExecCmd('npm install --save-dev bluebird', function(err, res) %7B%0A//   if (err) return console.log('npm install --save-dev bluebird', err);%0A//   console.log('npm install --save-dev bluebird');%0A// %7D) //=%3E work
 %0A// 
@@ -663,10 +663,10 @@
 npm 
-ls
+-v
 ', %7B
@@ -697,337 +697,1597 @@
 ion(
-) %7B%7D)%0A// asyncExecCmd('npm', %5B'install', 'semver'%5D, function() %7B%7D)%0A// asyncExecCmd('echo', %5B'hello world'%5D, %7Bstdio: 'inherit'%7D, function() %7B%7D)%0A// asyncExecCmd('npm i lodash', 'invalid second arg', %7Bstdio: 'inherit'%7D, function() %7B%7D)%0A// asyncExecCmd('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid', function() %7B%7D)%0A//
+err, res) %7B%0A//   if (err) return console.log('npm -v', err);%0A//   console.log('npm -v');%0A// %7D) //=%3E work%0A// asyncExecCmd('npm', %5B'install', 'semver', '--save-dev'%5D, function(err, res) %7B%0A//   if (err) return console.log('npm', %5B'install', 'semver', '--save-dev'%5D, err);%0A//   console.log('npm', %5B'install', 'semver', '--save-dev'%5D);%0A// %7D) //=%3E work%0A// asyncExecCmd('echo', %5B'hello world'%5D, %7Bstdio: 'inherit'%7D, function(err, res) %7B%0A//   if (err) return console.log('echo', %5B'hello world'%5D, %7Bstdio: 'inherit'%7D, err);%0A//   console.log('echo', %5B'hello world'%5D, %7Bstdio: 'inherit'%7D);%0A// %7D) //=%3E work%0A%0A// asyncExecCmd('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid', function(err, res) %7B%0A//   if (err) return console.log('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid', err);%0A//   console.log('git clone git@github.com:tunnckoCore/glob2fp dest', 'invalid');%0A// %7D)%0A%0A%0A%0A// should throw: %22expect %60args%60 be array%22%0A// asyncExecCmd('npm i lodash', 'invalid second arg', %7Bstdio: 'inherit'%7D, function(err, res) %7B%0A//   if (err) return console.log('err');%0A//   console.log('npm i lodash', 'invalid second arg', %7Bstdio: 'inherit'%7D);%0A// %7D) //=%3E work%0A// should throw: %22expect %60args%60 be array%22%0A// asyncExecCmd('npm i lodash', %7Bexecp: true%7D, %7Bstdio: 'inherit'%7D, function(err, res) %7B%0A//   if (err) return console.log('err');%0A//   console.log('npm i lodash', %7B%7D, %7Bstdio: 'inherit'%7D);%0A// %7D) //=%3E work%0A// should throw%0A// asyncExecCmd('npm i lodash', %5B'--save-dev'%5D, 'invalid', function(err, res) %7B%0A//   if (err) throw err;%0A//   console.log('npm i lodash', %7B%7D, 'invalid');%0A// %7D) //=%3E work%0A
 %0A// 

add more test cases, need implement