Added tests for hookCommand

This PR fixes a small bug on windows and adds more unit tests for the uniter.
defer restorer()