diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-24 09:37:20 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-11-24 09:37:20 +0000 |
| commit | c53b4f562bc1b4b2058c44fcf6e71ce0352c35d2 (patch) | |
| tree | 31eadcfca2f5ce0c9a328d919ab357c1330059f5 | |
| parent | 1c1c514a678fae819117e07743eceb0c8d431bfd (diff) | |
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
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | lib/tracer.rb | 2 | ||||
| -rw-r--r-- | test/test_tracer.rb | 20 | ||||
| -rw-r--r-- | version.h | 2 |
4 files changed, 27 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Fri Sep 17 08:30:27 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * 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 <nobu@ruby-lang.org> * 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<internal:[^<>]+>:/ !~ 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:<internal:lib/rubygems/custom_require>:\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 @@ -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 |
