diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 17:00:30 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-30 17:00:30 +0000 |
commit | 12f2f7371f2dcf9c8da2a96fa251d1af2a7e977e (patch) | |
tree | 70a25ad7b5cf5a7404817c2c0d03a4d0060e8603 /test/ruby/test_iseq.rb | |
parent | 60317fa81df069a7a2a7bdcb0aaaaebc9b77bed9 (diff) | |
download | ruby-12f2f7371f2dcf9c8da2a96fa251d1af2a7e977e.tar.gz |
[EXPERIMENTAL]
* iseq.c: add following two methods.
* ISeq#line_trace_all returns all line traces (line numbers)
* ISeq#line_trace_specify(pos, set) set `pos'th line event to
specified_line event (if set is true).
These features are introduced for debuggers (mainly to make
breakpoint).
* iseq.h: add decl. of C APIs.
* test/ruby/test_iseq.rb: add tests.
* vm_trace.c: add `specified_line' event.
* include/ruby/ruby.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_iseq.rb')
-rw-r--r-- | test/ruby/test_iseq.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index ad5391383e..ac140aabde 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -25,4 +25,28 @@ class TestISeq < Test::Unit::TestCase ensure Encoding.default_internal = enc end + + def test_line_trace + iseq = ISeq.compile \ + %q{ a = 1 + b = 2 + c = 3 + # d = 4 + e = 5 + # f = 6 + g = 7 + + } + assert_equal([1, 2, 3, 5, 7], iseq.line_trace_all) + iseq.line_trace_specify(1, true) # line 2 + iseq.line_trace_specify(3, true) # line 5 + + result = [] + TracePoint.new(:specified_line){|tp| + result << tp.lineno + }.enable{ + iseq.eval + } + assert_equal([2, 5], result) + end end |