Move test code into test file