Sha256: a8c5e06a374040cb914d83f1724a48e1975f67681db8e861a4e62096a6470453

Contents?: true

Size: 883 Bytes

Versions: 52

Compression:

Stored size: 883 Bytes

Contents

require File.expand_path('../../../../spec_helper', __FILE__)
require 'set'

describe "SortedSet#each" do
  before(:each) do
    @set = SortedSet[1, 2, 3]
  end

  it "yields each Object in self in sorted order" do
    ret = []
    SortedSet["one", "two", "three"].each { |x| ret << x }
    ret.should == ["one", "two", "three"].sort
  end

  ruby_bug "http://redmine.ruby-lang.org/issues/show/116", "1.8.7.7" do
    it "returns self" do
      @set.each { |x| x }.should equal(@set)
    end
  end

  ruby_version_is "1.8.7" do
    it "returns an Enumerator when not passed a block" do
      enum = @set.each

      ret = []
      enum.each { |x| ret << x }
      ret.sort.should == [1, 2, 3]
    end
  end

  ruby_version_is "" ... "1.8.7" do
    it "raises a LocalJumpError when not passed a block" do
      lambda { @set.each }.should raise_error(LocalJumpError)
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-3.3.5 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb
rhodes-3.4.2 spec/framework_spec/app/spec/library/set/sortedset/each_spec.rb