Skip to content

Commit

Permalink
Added missing CallSite#reset spec file.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Apr 27, 2016
1 parent 12f88d4 commit 938a434
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions spec/core/callsite/reset_spec.rb
@@ -0,0 +1,37 @@
require File.expand_path('../../fixtures/call_site.rb', __FILE__)

describe "Rubinius::CallSite#reset" do
before :each do
@klass = Class.new do
def m(a)
a.to_s
end
end

@call_site = @klass.instance_method(:m).executable.call_sites.first
end

it "clears the caches" do
obj = @klass.new

obj.m 1
obj.m :a

@call_site.depth.should == 1
@call_site.reset

@call_site.depth.should == 0
end

it "sets the invokes to 0" do
obj = @klass.new

obj.m 1
obj.m :a

@call_site.invokes.should == 2
@call_site.reset

@call_site.invokes.should == 0
end
end

0 comments on commit 938a434

Please sign in to comment.