Sha256: 9705739aec75f62a24a2b6c50889e5a5954941a1192790d774ebeff16715132c

Contents?: true

Size: 390 Bytes

Versions: 6

Compression:

Stored size: 390 Bytes

Contents

describe "Kernel.loop" do
  it "calls block until it is terminated by a break" do
    i = 0
    loop do
      i = i + 1
      break if i == 10
    end
    
    i.should == 10
  end
  
  it "returns value passed to break" do
    loop do
      break 123
    end.should == 123
  end
  
  it "returns nil if no value passed to break" do
    loop do
      break
    end.should == nil
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
opal-0.3.2 gems/core/spec/core/kernel/loop_spec.rb
opal-0.3.1 gems/core/spec/core/kernel/loop_spec.rb
opal-0.3.0 gems/core/spec/core/kernel/loop_spec.rb
opal-0.2.2 opals/opal/opal/spec/core/kernel/loop_spec.rb
opal-0.2.0 opals/opal/opal/spec/core/kernel/loop_spec.rb
opal-0.1.0 opals/opal/spec/core/kernel/loop_spec.rb