Sha256: 44b7f34155515d27a5d7266a1ac65acea9c22c8a94b816d431d5481627e8becd

Contents?: true

Size: 621 Bytes

Versions: 19

Compression:

Stored size: 621 Bytes

Contents

require 'support/parser_helpers'

describe "The return keyword" do
  it "should return s(:return) when given no arguments" do
    parsed("return").should == [:return]
  end

  it "returns s(:return) with the direct argument when given one argument" do
    parsed("return 1").should == [:return, [:int, 1]]
    parsed("return *2").should == [:return, [:splat, [:int, 2]]]
  end

  it "returns s(:return) with an s(:array) when args size > 1" do
    parsed("return 1, 2").should == [:return, [:array, [:int, 1], [:int, 2]]]
    parsed("return 1, *2").should == [:return, [:array, [:int, 1], [:splat, [:int, 2]]]]
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
opal-0.9.0.beta2 spec/lib/parser/return_spec.rb
opal-0.9.0.beta1 spec/lib/parser/return_spec.rb
opal-0.8.1 spec/lib/parser/return_spec.rb
opal-0.8.1.rc1 spec/lib/parser/return_spec.rb
opal-wedge-0.9.0.dev spec/lib/parser/return_spec.rb
opal-0.8.0 spec/lib/parser/return_spec.rb
opal-0.8.0.rc3 spec/lib/parser/return_spec.rb
opal-0.8.0.rc2 spec/lib/parser/return_spec.rb
opal-0.8.0.rc1 spec/lib/parser/return_spec.rb
opal-0.8.0.beta1 spec/lib/parser/return_spec.rb
opal-0.7.2 spec/lib/parser/return_spec.rb
opal-0.7.1 spec/lib/parser/return_spec.rb
opal-0.7.0 spec/lib/parser/return_spec.rb
opal-0.7.0.rc1 spec/lib/parser/return_spec.rb
opal-0.7.0.beta3 spec/lib/parser/return_spec.rb
opal-0.7.0.beta2 spec/lib/parser/return_spec.rb
opal-cj-0.7.0.beta2 spec/lib/parser/return_spec.rb
opal-cj-0.7.0.beta1 spec/lib/parser/return_spec.rb
opal-0.7.0.beta1 spec/lib/parser/return_spec.rb