testsuite: Add test for #5582, which passes.

Closes #5582