Add unit test request in #1943

This pull requests includes the merge request from @kdmukai in #1943 + a small whitespace cleanup + a unit test for the new behaviour.