Move test utility function to _test.go file.