rdmd: Fix `--dry-run`, add test for issue 11983

Continuation of https://github.com/D-Programming-Language/tools/pull/112