Refactor duplicate test code into a run_test subroutine.