Fix test failure on windows

It needs switching windows or othres because lib/rubygems/test_case.rb:283
switches the platform string.

Import of r41889 by naruse from ruby trunk
Fix shebang test failure introduced at r41873

On Windows, it doesn't use /usr/bin/env.

Import of r41891 by naruse from ruby trunk
Fix PATH environ related test failure

On Windows PATH_SEPARATOR is ';'.  Therefore it can't be hardcoded.

Import of r41892 by naruse from ruby trunk
Fix warnings