Sha256: d9e37e2d5289d6071322f0b544f5fc15c28983c455ac7fb83fa8bde89e297b3c

Contents?: true

Size: 812 Bytes

Versions: 10

Compression:

Stored size: 812 Bytes

Contents

require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/classes', __FILE__)
require File.expand_path('../shared/iteration', __FILE__)

describe "Hash#each_key" do

=begin self
  it "returns self" do
    h = new_hash(1 => -1, 2 => -2, 3 => -3, 4 => -4)
    h.each_key { |k| }.should equal(h)
  end
=end
    
  it "calls block once for each key, passing key" do
    r = new_hash
    h = new_hash(1 => -1, 2 => -2, 3 => -3, 4 => -4)
    h.each_key { |k| r[k] = k }
    r.should == new_hash(1 => 1, 2 => 2, 3 => 3, 4 => 4)
  end

  it "processes keys in the same order as keys()" do
    keys = []
    h = new_hash(1 => -1, 2 => -2, 3 => -3, 4 => -4)
    h.each_key { |k| keys << k }
    keys.should == h.keys
  end

  it_behaves_like(:hash_iteration_no_block, :each_key)
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
jactive_support-2.1.2 spec/java_ext/map/each_key_spec.rb
jactive_support-3.0.0 spec/java_ext/map/each_key_spec.rb
jactive_support-3.0.0.pre2 spec/java_ext/map/each_key_spec.rb
jactive_support-3.0.0.pre1 spec/java_ext/map/each_key_spec.rb
jactive_support-2.1.1 spec/java_ext/map/each_key_spec.rb
jactive_support-2.1.0 spec/java_ext/map/each_key_spec.rb
jactive_support-2.0.0 spec/java_ext/map/each_key_spec.rb
jactive_support-1.0.2 spec/java_ext/map/each_key_spec.rb
jactive_support-1.0.1-universal-java-1.6 spec/java_ext/map/each_key_spec.rb
jactive_support-1.0.0-universal-java-1.6 spec/java_ext/map/each_key_spec.rb