Regression test for issue 2842

I would like to add this to catch future regressions.