Sha256: 0a26424948406629adc822303ab6536fd3f1e655d85846fad31da28711ff9e62

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require_relative '../test-util'

describe 'Model::Message' do
  before do
    @a = Model::Message.new("next", 1)
    @b = Model::Message.new("substring", "abcdefg", 2, 3)
  end

  it 'should equal' do
    @a.should == Model::Message.new("next", 1)
    @b.should == Model::Message.new("substring", "abcdefg", 2, 3)
  end

  it 'should not equal' do
    @a.should.not == @b
  end

  it 'should send message' do
    @a.eval(VariableTable.new).should == 2.to_pione
    @b.eval(VariableTable.new).should == "cde".to_pione
  end

  it 'should get the method result from variable table' do
    vtable = VariableTable.new
    vtable.set(Variable.new("X"), @a)
    vtable.get(Variable.new("X")).should == 2.to_pione
    vtable.to_hash[Variable.new("X")].should == @a
  end

  it 'should not include variables' do
    @a.should.not.include_variable
  end

  it 'should include variables' do
    Message.new(
      "next", Variable.new("N")
    ).should.include_variable
    Message.new(
      "substring", "abcdef", Variable.new("FROM"), Variable.new("TO")
    ).should.include_variable
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pione-0.1.3 test/model/spec_message.rb
pione-0.1.2 test/model/spec_message.rb
pione-0.1.1 test/model/spec_message.rb
pione-0.1.0 test/model/spec_message.rb