Sha256: b1453a3a5cc5fa05a893995b38f9437ee474dc44eecaddd5c210b20681a066c9

Contents?: true

Size: 1.25 KB

Versions: 14

Compression:

Stored size: 1.25 KB

Contents

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



describe CodeAtomQInstruction do
  
  it_should_behave_like "every Nudge Instruction"
  
  before(:each) do
    @context = Interpreter.new
    @i1 = CodeAtomQInstruction.new(@context)
  end
    
  describe "\#go" do
    before(:each) do
      @context = Interpreter.new
      @i1 = CodeAtomQInstruction.new(@context)
    end
    
    describe "\#cleanup" do
      it "should push a :bool indicating whether the :code value is an atom or not" do
        @context.stacks[:code].push(ValuePoint.new("code","ref x"))
        @i1.go
        @context.stacks[:bool].depth.should == 1
        @context.stacks[:code].depth.should == 0
        @context.stacks[:bool].peek.value.should == true
        
        @context.stacks[:code].push(ValuePoint.new("code","block {}"))
        @i1.go
        @context.stacks[:bool].peek.value.should == true
        
        @context.stacks[:code].push(ValuePoint.new("code","i have no idea"))
        @i1.go
        @context.stacks[:bool].peek.value.should == false
        
        @context.stacks[:code].push(ValuePoint.new("code","block {ref a}"))
        @i1.go
        @context.stacks[:bool].peek.value.should == false
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

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