Add unit tests and fix some false positives when checking for calls to register_widget()