-
Notifications
You must be signed in to change notification settings - Fork 155
Silence expected warning about __id__ definition
#2469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| it "might return the wrong results without Reflection helpers" do | ||
| foo = LyingFoo.new | ||
|
|
||
| refute_equal([], LyingFoo.constants) | ||
| refute_equal("Tapioca::LyingFoo", LyingFoo.name) | ||
| refute_equal([Object, Kernel, BasicObject], LyingFoo.ancestors) | ||
| refute_equal(Object, LyingFoo.superclass) | ||
| assert_equal(String, LyingFoo.singleton_class) | ||
| assert_equal([:foo, :bar, :baz], LyingFoo.public_instance_methods) | ||
| assert_equal([:foo, :bar, :baz], LyingFoo.protected_instance_methods) | ||
| assert_equal([:foo, :bar, :baz], LyingFoo.private_instance_methods) | ||
| assert_equal(:lies, LyingFoo.method(:class)) | ||
|
|
||
| refute_equal(LyingFoo, foo.class) | ||
| assert_equal(1, foo.__id__) | ||
| refute(foo.equal?(foo)) | ||
| assert(foo.equal?(1)) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we even need this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test is useful since it would error if someone removed the bind_call versions of the various look-ups.
| assert_instance_of(Method, method) | ||
|
|
||
| assert_equal(LyingFoo, Runtime::Reflection.class_of(foo)) | ||
| refute_equal(1, Runtime::Reflection.object_id_of(foo)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we not override __id__ and just test the id against the real one?
| refute_equal(foo.__id__, Runtime::Reflection.object_id_of(foo)) |
Motivation
Removes this line noise from CI logs:
Implementation
Hooks in the
Warningcallback chain, raises and exception, and ignores it if it's the one we expected.