Exit the loop if the test succeeds