Sha256: a26ad7d3a3c22e37193ca10d262a01871d64011acea85e9ae20636170c402478

Contents?: true

Size: 743 Bytes

Versions: 39

Compression:

Stored size: 743 Bytes

Contents

require 'support/parser_helpers'

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

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

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

Version data entries

39 entries across 39 versions & 3 rubygems

Version Path
opal-0.10.6 spec/lib/parser/yield_spec.rb
opal-0.10.6.beta spec/lib/parser/yield_spec.rb
opal-0.10.5 spec/lib/parser/yield_spec.rb
opal-0.10.4 spec/lib/parser/yield_spec.rb
opal-0.10.3 spec/lib/parser/yield_spec.rb
opal-0.10.2 spec/lib/parser/yield_spec.rb
opal-0.10.1 spec/lib/parser/yield_spec.rb
opal-0.10.0 spec/lib/parser/yield_spec.rb
opal-0.10.0.rc2 spec/lib/parser/yield_spec.rb
opal-0.9.4 spec/lib/parser/yield_spec.rb
opal-0.9.3 spec/lib/parser/yield_spec.rb
opal-0.10.0.rc1 spec/lib/parser/yield_spec.rb
opal-0.10.0.beta5 spec/lib/parser/yield_spec.rb
opal-0.10.0.beta4 spec/lib/parser/yield_spec.rb
opal-0.10.0.beta3 spec/lib/parser/yield_spec.rb
opal-0.10.0.beta2 spec/lib/parser/yield_spec.rb
opal-0.10.0.beta1 spec/lib/parser/yield_spec.rb
opal-0.9.2 spec/lib/parser/yield_spec.rb
opal-0.9.0 spec/lib/parser/yield_spec.rb
opal-0.9.0.rc1 spec/lib/parser/yield_spec.rb