Sha256: 1f6402c3ded7944b59c25f3a92ad6ae42b906f6f250e3fffa87bc336fb0b4681

Contents?: true

Size: 615 Bytes

Versions: 29

Compression:

Stored size: 615 Bytes

Contents

require 'spec_helper'

class RescueReturningSpec
  def single
    begin
      raise "ERROR"
    rescue
      :foo
    end
  end

  def multiple
    begin
      raise "ERROR"
    rescue
      to_s
      :bar
    end
  end

  def empty_rescue
    begin
      raise "ERROR"
    rescue
    end
  end
end

describe "The rescue keyword" do
  it "returns last value of expression evaluated" do
    RescueReturningSpec.new.single.should == :foo
    RescueReturningSpec.new.multiple.should == :bar
  end

  it "returns nil if no expr given in rescue body" do
    RescueReturningSpec.new.empty_rescue.should be_nil
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
opal-0.9.0 spec/opal/core/runtime/rescue_spec.rb
opal-0.9.0.rc1 spec/opal/core/runtime/rescue_spec.rb
opal-0.9.0.beta2 spec/opal/core/runtime/rescue_spec.rb
opal-0.9.0.beta1 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.1 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.1.rc1 spec/opal/core/runtime/rescue_spec.rb
opal-wedge-0.9.0.dev spec/opal/core/runtime/rescue_spec.rb
opal-0.8.0 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.0.rc3 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.0.rc2 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.0.rc1 spec/opal/core/runtime/rescue_spec.rb
opal-0.8.0.beta1 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.2 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.1 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.0 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.0.rc1 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.0.beta3 spec/opal/core/runtime/rescue_spec.rb
opal-0.6.3 spec/opal/core/runtime/rescue_spec.rb
opal-0.7.0.beta2 spec/opal/core/runtime/rescue_spec.rb
opal-cj-0.7.0.beta2 spec/opal/core/runtime/rescue_spec.rb