fix Issue 9948 - -deps dependency printing incorrect for templates

This fix is based on the just merged pull request:

 https://github.com/D-Programming-Language/dmd/pull/2550

by Walter Bright. It made this fix trivial (at least the test case in the bug report is working correctly now).
Added a simple test case for 9948.
Adopted test case to D coding styles.
Hopefully fixed auto test issues.
Merge pull request #2553 from eskimor/fix9948

fix Issue 9948 - -deps dependency printing incorrect for templates