testsuite: Tests for #6458. Closes #6458