Skip to content

Commit

Permalink
Update tracing test to match released MRI behavior. Make 'return' eve…
Browse files Browse the repository at this point in the history
…nts match MRI

git-svn-id: http://svn.codehaus.org/jruby/trunk/jruby@7204 961051c9-f516-0410-bf72-c9f7e237a7b7
  • Loading branch information
enebo committed Jul 17, 2008
1 parent c68e71e commit 10b0ce3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/org/jruby/Ruby.java
Expand Up @@ -2125,7 +2125,7 @@ public void event(ThreadContext context, int event, String file, int line, Strin
traceFunc.call(context, new IRubyObject[] {
newString(EVENT_NAMES[event]), // event name
newString(file), // filename
newFixnum(line + 1), // line numbers should be 1-based
newFixnum(line + (event == RUBY_EVENT_RETURN ? 2 : 1)), // line numbers should be 1-based
name != null ? newSymbol(name) : getNil(),
binding,
type
Expand Down
8 changes: 4 additions & 4 deletions test/tracing/test_trace_func.rb
Expand Up @@ -72,7 +72,7 @@ def test_method_trace
" line #{__FILE__}:#{line - 10} sample_method TestTraceFunc",
" c-call #{__FILE__}:#{line - 10} + Fixnum",
" c-return #{__FILE__}:#{line - 10} + Fixnum",
" return #{__FILE__}:#{line - 10} sample_method TestTraceFunc",
" return #{__FILE__}:#{line - 9} sample_method TestTraceFunc",
" line #{__FILE__}:#{line + 2} test_method_trace TestTraceFunc",
" c-call #{__FILE__}:#{line + 2} set_trace_func Kernel"];
assert_equal(expected, output)
Expand Down Expand Up @@ -145,11 +145,11 @@ def test_require_trace_full_paths # JRUBY-2722
set_trace_func nil

line = __LINE__ - 4
expected = ["./test/tracing/test_trace_func.rb line #{line} test_require_trace_full_paths TestTraceFunc",
expected = ["test/tracing/test_trace_func.rb line #{line} test_require_trace_full_paths TestTraceFunc",
"./test/tracing/dummy1.rb line 1 nil false",
"./test/tracing/dummy1.rb class 1 nil false",
"./test/tracing/dummy1.rb end 1 nil false",
"./test/tracing/test_trace_func.rb line #{line + 2} test_require_trace_full_paths TestTraceFunc"]
"test/tracing/test_trace_func.rb line #{line + 2} test_require_trace_full_paths TestTraceFunc"]

assert_equal(expected, output);
end
Expand Down Expand Up @@ -199,7 +199,7 @@ def test_return # JRUBY-2723
"other.rb line 2 in_other Object",
"other.rb c-call 2 sleep Kernel",
"other.rb c-return 2 sleep Kernel",
"other.rb return 2 in_other Object",
"other.rb return 3 in_other Object",
"test_trace_func.rb line #{line + 3} test_return TestTraceFunc",
"test_trace_func.rb c-call #{line + 3} set_trace_func Kernel"]

Expand Down

0 comments on commit 10b0ce3

Please sign in to comment.