unit test: added new cases for legal_file helper
unit test: fixed bugs in legal_file helper test (oops)