From c53b4f562bc1b4b2058c44fcf6e71ce0352c35d2 Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 24 Nov 2010 09:37:20 +0000 Subject: [PATCH] merges r29280 from trunk into ruby_1_9_2 and adds a minimal regression test. -- * lib/tracer.rb: count only non-internal libraries in stack trace, ignoring custom_require. [ruby-core:31858] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@29914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/tracer.rb | 2 +- test/test_tracer.rb | 20 ++++++++++++++++++++ version.h | 2 +- 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 test/test_tracer.rb diff --git a/ChangeLog b/ChangeLog index ff2542f9ec..f38830e412 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Fri Sep 17 08:30:27 2010 Nobuyoshi Nakada + + * lib/tracer.rb: count only non-internal libraries in stack trace, + ignoring custom_require. [ruby-core:31858] + Thu Sep 16 08:30:28 2010 Nobuyoshi Nakada * sprintf.c (rb_f_sprintf): fix rdoc. pointed out by Tomoyuki diff --git a/lib/tracer.rb b/lib/tracer.rb index a0b4fdf133..318b254ac8 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -190,6 +190,6 @@ if $0 == __FILE__ ARGV.shift Tracer.on require $0 -elsif caller.size <= 1 +elsif caller.count {|bt| /\A]+>:/ !~ bt} <= 1 Tracer.on end diff --git a/test/test_tracer.rb b/test/test_tracer.rb new file mode 100644 index 0000000000..2580205338 --- /dev/null +++ b/test/test_tracer.rb @@ -0,0 +1,20 @@ +require 'test/unit' +require_relative 'ruby/envutil' + +class TestTracer < Test::Unit::TestCase + include EnvUtil + + def test_work_with_e + assert_in_out_err(%w[-rtracer -e 1]) do |(*lines),| + case lines.size + when 2 + assert_match %r[#0::\d+:Kernel:<: -], lines[0] + when 1 + # do nothing + else + flunk 'unexpected output from `ruby -rtracer -e 1`' + end + assert_equal "#0:-e:1::-: 1", lines[1] + end + end +end diff --git a/version.h b/version.h index 3ab160be85..b3c9161237 100644 --- a/version.h +++ b/version.h @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.2" -#define RUBY_PATCHLEVEL 46 +#define RUBY_PATCHLEVEL 47 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9 #define RUBY_VERSION_TEENY 1