summaryrefslogtreecommitdiff
path: root/spec/ruby/core/tracepoint/parameters_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/tracepoint/parameters_spec.rb')
-rw-r--r--spec/ruby/core/tracepoint/parameters_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/ruby/core/tracepoint/parameters_spec.rb b/spec/ruby/core/tracepoint/parameters_spec.rb
new file mode 100644
index 0000000000..4728b0a448
--- /dev/null
+++ b/spec/ruby/core/tracepoint/parameters_spec.rb
@@ -0,0 +1,21 @@
+require_relative '../../spec_helper'
+
+describe 'TracePoint#parameters' do
+ it 'returns the parameters of block' do
+ f = proc {|x, y, z| }
+ parameters = nil
+ TracePoint.new(:b_call) {|tp| parameters = tp.parameters }.enable do
+ f.call
+ parameters.should == [[:opt, :x], [:opt, :y], [:opt, :z]]
+ end
+ end
+
+ it 'returns the parameters of lambda block' do
+ f = lambda {|x, y, z| }
+ parameters = nil
+ TracePoint.new(:b_call) {|tp| parameters = tp.parameters }.enable do
+ f.call(1, 2, 3)
+ parameters.should == [[:req, :x], [:req, :y], [:req, :z]]
+ end
+ end
+end