Sha256: 8831ed1268668883e8d11dfc41ccb5ec3a36342748f1ea1de892e7b093268194

Contents?: true

Size: 456 Bytes

Versions: 6

Compression:

Stored size: 456 Bytes

Contents

describe "The redo statement" do
  it "restarts block execution if used within block" do
    a = []
    lambda {
      a << 1
      redo if a.size < 2
      a << 2
    }.call
    a.should == [1, 1, 2]
  end
  
  it "re-executes the closest loop"
  
  it "re-executes the last step in enumeration" do
    list = []
    [1,2,3].each do |x|
      list << x
      break if list.size == 6
      redo if x == 3
    end
    list.should == [1,2,3,3,3,3]
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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