Fixed #2981: clear up the test codes