add tests from #2311

Add unittests from reverted https://github.com/D-Programming-Language/phobos/pull/2311