Add unit test to catch #156 and fix it

Here is the fix suggested by @koto in https://github.com/openpgpjs/openpgpjs/pull/157

I also added a test to catch future regressions. @toberndo I hope it's in the right place?