James Moore
2007-Jul-21 19:27 UTC
Suggestion for filtering your stack traces with Test::Unit::Util::BacktraceFilter
Most of the time, I don''t want to see the whole stack trace including
the environment - I just want to see my code. So, I tossed this in my
test:
module Test
module Unit
module Util
module BacktraceFilter
def filter_backtrace_with_only_my_code(backtrace, prefix=nil)
result = filter_backtrace_without_only_my_code backtrace, prefix
result.reject! {|x| x =~ /ruby.lib.ruby/}
result.reject! {|x| x =~ /vendor.plugins.mocha/}
result
end
alias_method_chain :filter_backtrace, :only_my_code
end
end
end
end
You''ll probably want to play around with what gets filtered in and
out. I think of this sort of thing as more of a debugger macro than
actual code; it gets changed constantly depending on what I''m doing.
--
James Moore | james-7AXNjMB9LsNl57MIdRCFDg@public.gmane.org
Ruby and Ruby on Rails consulting
blog.restphone.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Andrew Stewart
2007-Jul-25 16:27 UTC
Re: Suggestion for filtering your stack traces with Test::Unit::Util::BacktraceFilter
Hi James,> Most of the time, I don''t want to see the whole stack trace including > the environment - I just want to see my code. So, I tossed this in my > test: > [snip] > You''ll probably want to play around with what gets filtered in and > out. I think of this sort of thing as more of a debugger macro than > actual code; it gets changed constantly depending on what I''m doing.That looks really useful. Thanks. I felt the same way when running tests using Autotest and came up with a similar solution, though mine''s confined to Autotest: http://blog.airbladesoftware.com/2007/3/22/filtering-autotest-s-output Regards, Andy Stewart --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---