Adding tests to cover bug 933.

The actual fix was in 7bdbfb2719a1.

This commit adds tests to cover the scenario mentioned in the bug.