Sha256: 37d08173584b11d66a1266bbd0f7180458f9bd98b2c8db7e871026aafc4f6aa0

Contents?: true

Size: 1.02 KB

Versions: 14

Compression:

Stored size: 1.02 KB

Contents

#encoding: utf-8
require File.join(File.dirname(__FILE__), "../../spec_helper")
include Nudge


describe ExecDepthInstruction do
  
  it_should_behave_like "every Nudge Instruction"
  
  before(:each) do
    @context = Interpreter.new
    @i1 = ExecDepthInstruction.new(@context)
  end
  
  
  describe "\#go" do
    before(:each) do
      @i1 = ExecDepthInstruction.new(@context)
      @context.reset("block{value «bool» value «int» block {}}\n«bool»false\n«int»88")
    end
    
    describe "\#preconditions?" do
      it "should check that the :bool stack responds to #depth" do
        @i1.preconditions?.should == true
      end
    end
    
    describe "\#cleanup" do
      it "should count the items on the stack and push it onto the :int stack" do
        @context.stacks[:int].depth.should == 0
        @i1.go
        @context.stacks[:int].peek.value.should == 1
        @context.step # unpacking the three points onto :exec
        @i1.go
        @context.stacks[:int].peek.value.should == 3
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
nudge-0.2.9 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.8 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.7 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.6 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.5 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.4 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.3 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.2 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.1 spec/instructions/exec/exec_depth_spec.rb
nudge-0.2.0 spec/instructions/exec/exec_depth_spec.rb
nudge-0.1.3 spec/instructions/exec/exec_depth_spec.rb
nudge-0.1.2 spec/instructions/exec/exec_depth_spec.rb
nudge-0.1.1 spec/instructions/exec/exec_depth_spec.rb
nudge-0.1.0 spec/instructions/exec/exec_depth_spec.rb