Add some unit tests for the query function.
Merge pull request #37 from tommy/query-unit-tests

Add some unit tests for the query function (@tommy)