Regression tests for GH-1059.

Regression tests to show #1059 fails.

The branch is merged into #1051 to show it passes there.

Do not merge alone, only as part of #1051.