Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Specs for Rubinius::Debugger::Frame

  • Loading branch information...
commit 5fccae3a655c5130c713cffd60fc91e3259d192d 1 parent 190fd4b
@txus authored
Showing with 29 additions and 7 deletions.
  1. +29 −7 spec/debugger/frame_spec.rb
View
36 spec/debugger/frame_spec.rb
@@ -2,23 +2,22 @@
describe "Rubinius::Debugger::Frame" do
before do
- compiled_method = def ten
- a + 7
- end
+ 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
+ @location = Rubinius::Location.new
+ @location.instance_eval do
@variables = variable_scope
@method = compiled_method
@static_scope = compiled_method.scope
+ @ip = 0
end
- @debugger = mock('debugger')
- @frame = Rubinius::Debugger::Frame.new(@debugger, 1, location)
+ @debugger = Rubinius::Debugger.new
+ @frame = Rubinius::Debugger::Frame.new(@debugger, 1, @location)
end
describe "#run" do
@@ -27,4 +26,27 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.