bug #898 - add tests

https://gist.github.com/aadamski/1a196c81f5722cdcfd72