Add a test to check "init" is not allowed to be defined in a class, and refactor the check into a function.