This adds additional coverage of the situation reported in #7195 to prevent against regression. The actual fix was in 2356afd, in response to #7143.
2356afd