Add test for issue 7181. Fixes #7181.