Fix #1261: Forward-port additional test for #1252

Originates from: c63d49981b4e7b86e13c4888b3bf680e27bcfdaf which is a
backport commit to 0.5.x that adds an additional test case.
Merge pull request #1264 from gzm0/backport-test

Fix #1261: Forward-port additional test for #1252