Sha256: da7fa122e72015150a0588dbdcd1f7e0aefff3c2e0549a6fa80cdbd529ee0a7e

Contents?: true

Size: 630 Bytes

Versions: 5

Compression:

Stored size: 630 Bytes

Contents

require 'spec_helper'

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

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opal-0.5.5 spec/opal/parser/return_spec.rb
opal-0.5.4 spec/opal/parser/return_spec.rb
opal-0.5.2 spec/opal/parser/return_spec.rb
opal-0.5.0 spec/opal/parser/return_spec.rb
opal-0.4.4 spec/parser/return_spec.rb