Unit test for bug #1025

This adds an explicit unit test for bug #1025 -- and the old
code really does crash on this unit test.