better heuristic for checking for done_testing (thanks ilmari!)