Add tests for RT #77114 and related cases.