Sha256: a0fe874ae095ed3873dd1edad9566ea7f4a556a2b58014efde432cf085525201

Contents?: true

Size: 994 Bytes

Versions: 7

Compression:

Stored size: 994 Bytes

Contents

require 'ronin/code/symbol_table'

require 'spec_helper'

describe Code::SymbolTable do
  before(:all) do
    @one = [:a, :b, :c]
    @two = {:one => 1, :two => 2}

    @table = Code::SymbolTable.new(:one => @one, :two => @two)
  end

  it "should have symbols" do
    @table.has_symbol?(:one).should == true
    @table.has_symbol?(:two).should == true
  end

  it "should provide transparent access to the symbol values" do
    @table[:one].should == [:a, :b, :c]

    @table[:one] = [:d, :e]
    @table[:one].should == [:d, :e]
  end

  it "should provide direct access to the symbols" do
    @table.symbol(:two).value.should == {:one => 1, :two => 2}
  end

  it "should be able to retrieve symbols and actual values" do
    @table.symbols.each do |name,value|
      @table.symbol(name).value.should == value
    end
  end

  it "should be able to set symbols en-mass" do
    @table.symbols = {:three => 3, :four => 4}

    @table[:three].should == 3
    @table[:four].should == 4
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ronin-0.1.2 spec/code/symbol_table_spec.rb
ronin-0.1.4 spec/code/symbol_table_spec.rb
ronin-0.1.3 spec/code/symbol_table_spec.rb
ronin-0.2.2 spec/code/symbol_table_spec.rb
ronin-0.2.0 spec/code/symbol_table_spec.rb
ronin-0.2.1 spec/code/symbol_table_spec.rb
ronin-0.2.3 spec/code/symbol_table_spec.rb