Add unittest for issue 6381.

To prevent regressions.