Rewrite all tests to use tape

As discussed at #1003, migrate tests to use @substack's [`tape`](https://github.com/substack/tape) testing framework which outputs [`tap`](http://testanything.org/).

This is a massive PR, but I hope it can be reviewed and merged quickly because:

- We badly need to move away from the ad-hoc testing structure we have now.  In the process of rewriting the tests I found a lot of instances where tests were not being called or were not working as expected.
- This will go stale pretty quickly if it's not merged.
- It was a lot of work on my end.

For pretty reporting, I'm using [`taper`](https://github.com/nylen/taper), a project I found, forked, and fixed up.  It's not perfect, but I couldn't find an existing tap reporter that met my wishlist:

- Clean, concise, preferably colored output, with clear indications of where errors occur
- Test file timeout support - this is crucial for tape because it's easy to forget to end a test properly, and when this happens they just hang.

You can see what the output looks like:

- [when all tests pass](https://travis-ci.org/nylen/request/jobs/37699501)
- [when some of them fail](https://travis-ci.org/nylen/request/jobs/37697054).

This should also help with the intermittent build failures we've been seeing on Travis.  For example, [this job output](https://travis-ci.org/nylen/request/jobs/37698924) gives more clues as to the problem with `test-timeout.js`.

I also cleaned up any code style issues that stood out to me, so we should be well-positioned to start linting the test directory as a next step.

I'll be around to help address any follow-up issues.
Os x

> On Oct 12, 2014, at 8:43 PM, James Nylen <notifications@github.com> wrote:
> 
> In tests/test-localAddress.js:
> 
> >  })
> >  
> > -request.get({
> > -  uri: 'http://www.google.com', localAddress: '127.0.0.1'
> > -}, function(err, res) {
> > -  assert(!res) // asserting that no response received
> > +tape('bind to local address', function(t) {
> > +  request.get({
> > +    uri: 'http://www.google.com',
> > +    localAddress: '127.0.0.1'
> > +  }, function(err, res) {
> > +    t.notEqual(err, null)
> > +    t.equal(err.message, 'connect EINVAL')
> @emkay what platform are you running on?
> 
> —
> Reply to this email directly or view it on GitHub.