Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubinius::Debugger::Frame specs #957

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions spec/debugger/frame_spec.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,52 @@
require File.expand_path('../spec_helper', __FILE__)

describe "Rubinius::Debugger::Frame" do
before do
compiled_method = def my_method; end

variable_scope = Rubinius::VariableScope.new
variable_scope.set_eval_local(:a, 3)
variable_scope.instance_eval { @method = compiled_method }

@location = Rubinius::Location.new
@location.instance_eval do
@variables = variable_scope
@method = compiled_method
@static_scope = compiled_method.scope
@ip = 0
end

@debugger = Rubinius::Debugger.new
@frame = Rubinius::Debugger::Frame.new(@debugger, 1, @location)
end

describe "#run" do
it 'runs the code within the frame binding' do
@frame.run('a + 3').should == 6
end
end

describe "#describe" do
it 'shows the location of the compiled method' do
@frame.describe.should =~ /NilClass#my_method/
end
end

describe "#method" do
it "is delegated to location" do
@frame.method.should == @location.method
end
end

describe "#ip" do
it "is delegated to location" do
@frame.ip.should == @location.ip
end
end

describe "#variables" do
it "is delegated to location" do
@frame.variables.dynamic_locals[:a].should == 3
end
end
end
4 changes: 2 additions & 2 deletions spec/debugger/spec_helper.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../../spec_helper', __FILE__)
require 'debugger/debugger' require 'rubinius/debugger'


require File.expand_path('../fixtures/classes', __FILE__) require File.expand_path('../fixtures/classes', __FILE__)