Sha256: dd999ddc730632c34ccf102b6af47ed5976f361059274e18ed5a69f1135aaf49

Contents?: true

Size: 1.16 KB

Versions: 14

Compression:

Stored size: 1.16 KB

Contents

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


describe ExecYInstruction do
  
  it_should_behave_like "every Nudge Instruction"
  
  before(:each) do
    @context = Interpreter.new
    @i1 = ExecYInstruction.new(@context)
  end
  
  
  describe "\#go" do
    before(:each) do
      @context = Interpreter.new
      @i1 = ExecYInstruction.new(@context)
      @context.reset("do int_add")
    end

    describe "\#preconditions?" do
      it "should check that the :exec stack has at least one item" do
        @i1.preconditions?.should == true
      end
    end

    describe "\#cleanup" do
      it "should end up with a block {do exec_y [something]} in the second position on the :exec stack" do
        @context.stacks[:exec].depth.should == 1
        @i1.go
        @context.stacks[:exec].depth.should == 2
        @context.stacks[:exec].peek.tidy.should == "do int_add"
        @context.stacks[:exec].entries[0].points.should == 3
        @context.stacks[:exec].entries[0].tidy.should include("do exec_y")
        @context.stacks[:exec].entries[0].tidy.should include(@context.stacks[:exec].peek.tidy)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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