Sha256: 2fdf4f91a30788cf6d488dc5895c72320cb59fb6f3b02be2fcc3b2603f7fa19e

Contents?: true

Size: 764 Bytes

Versions: 26

Compression:

Stored size: 764 Bytes

Contents

require 'spec_helper'

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

  it "appends arguments onto end of s(:yield) without an arglist" do
    opal_parse("yield 1").should == [:yield, [:lit, 1]]
    opal_parse("yield 1, 2").should == [:yield, [:lit, 1], [:lit, 2]]
    opal_parse("yield 1, *2").should == [:yield, [:lit, 1], [:splat, [:lit, 2]]]
  end

  it "accepts parans for any number of arguments" do
    opal_parse("yield()").should == [:yield]
    opal_parse("yield(1)").should == [:yield, [:lit, 1]]
    opal_parse("yield(1, 2)").should == [:yield, [:lit, 1], [:lit, 2]]
    opal_parse("yield(1, *2)").should == [:yield, [:lit, 1], [:splat, [:lit, 2]]]
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
opal-0.4.3 spec/parser/yield_spec.rb
opal-0.4.2 spec/parser/yield_spec.rb
opal-0.4.1 spec/parser/yield_spec.rb
opal-0.4.0 spec/parser/yield_spec.rb
opal-0.3.44 spec/parser/yield_spec.rb
opal-0.3.43 spec/parser/yield_spec.rb
opal-0.3.42 spec/grammar/yield_spec.rb
opal-0.3.41 spec/grammar/yield_spec.rb
opal-0.3.40 spec/grammar/yield_spec.rb
opal-0.3.39 spec/grammar/yield_spec.rb
opal-0.3.38 spec/grammar/yield_spec.rb
opal-0.3.37 spec/grammar/yield_spec.rb
opal-0.3.36 spec/grammar/yield_spec.rb
opal-0.3.35 spec/grammar/yield_spec.rb
opal-0.3.34 spec/grammar/yield_spec.rb
opal-0.3.33 spec/grammar/yield_spec.rb
opal-0.3.32 spec/grammar/yield_spec.rb
opal-0.3.31 spec/grammar/yield_spec.rb
opal-0.3.30 spec/grammar/yield_spec.rb
opal-0.3.29 spec/grammar/yield_spec.rb