Open andrykonchin opened 1 year ago
FYI @ioquatix
From a quick look the sus
gem doesn't use TracePoints itself: https://github.com/search?q=repo%3Aioquatix%2Fsus%20TracePoint&type=code
I'll try to investigate this when I have some time.
Related: https://github.com/oracle/truffleruby/issues/2371 Which might solve this, but we should understand why it doesn't work currently first.
sus
does not use trace points, but console
does to enable logging for classes.
It works like this:
# script.rb
class Foo
def do_something
Console.logger.debug(self, "Do something.")
end
end
Executed as so:
CONSOLE_DEBUG=Foo ruby ./script.rb
The mapping of class names to classes does not exist, so there is a "resolver" which attempts to resolve those strings to actual classes as they are loaded. This avoids using string comparisons of class names.
In any case, the 2nd example in the original report above is completely divorced from both console
and sus
.
If you think there is a better, more compatible way we could do this, I'd be totally fine to reimplement it.
The
console
gem CI fails on TruffleRuby because in a :class event isn't triggered when a new class is declared in a test case.The simplified example looks like so:
Expected result is:
But actual is:
If run this code as a plain Ruby script then result is expected:
The console gem CI job output:
https://github.com/socketry/console/actions/runs/5176976466/jobs/9326492884