Added unit tests for the "foreach" function.