Sha256: b921d9c6c83e2266296d345eb4f69849feb00ce83e0ab8e5f7d58c0bab1dff29

Contents?: true

Size: 543 Bytes

Versions: 6

Compression:

Stored size: 543 Bytes

Contents

describe "The next statement from within the block" do
  it "ends block execution" do
    a = []
    lambda {
      a << 1
      next
      a << 2
    }.call
    a.should == [1]
  end
  
  it "causes block to return nil if invoked without arguments" do
    lambda { 123; next; 456 }.call.should == nil
  end
  
  it "causes block to return nil if invoked with an empty expression" do
    lambda { next (); 456 }.call.should == nil
  end
  
  it "returns the argument passed" do
    lambda { 123; next 234; 345 }.call.should == 234
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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