Add some unit testing

Hey there,

I've been using this library for quite some time so I decided to try to contribute a little bit, and wrote some unit tests (because #109). I also changed the list of globs checked by JSHint to include the test cases.

![testcases-screenshot](https://cloud.githubusercontent.com/assets/877585/5423582/8aed415e-8329-11e4-8efa-33c1dd8e9653.png)

Coverage before:  

<p>
        Statements: <span class="metric">14.67% <small>(22 / 150)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">4.65% <small>(6 / 129)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">9.09% <small>(2 / 22)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">16.18% <small>(22 / 136)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
    </p>

Coverage after:

<p>
        Statements: <span class="metric">81.33% <small>(122 / 150)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Branches: <span class="metric">56.59% <small>(73 / 129)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Functions: <span class="metric">100% <small>(22 / 22)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        
        Lines: <span class="metric">88.24% <small>(120 / 136)</small></span> &nbsp;&nbsp;&nbsp;&nbsp;
        
        Ignored: <span class="metric"><span class="ignore-none">none</span></span> &nbsp;&nbsp;&nbsp;&nbsp;
    </p>

As for a sleek 100% coverage, IMHO it would require the script's internals to be exposed somehow. Worth the pain, I don't know.