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

Nice! I'll get these tests updated to use that.