Add tests for issues 4099, 7110 and 5217

I'm not sure about closing #7110, but current defaults for `dir` looks sane for me.