Sha256: 195f2957d3a3f039d626dcf90a1f38df68fcd6edfe4cf2dafbbbcf181956602a

Contents?: true

Size: 863 Bytes

Versions: 4

Compression:

Stored size: 863 Bytes

Contents

require 'spec_helper'

describe "The super keyword" do
  it "should return s(:super) for any arguments" do
    opal_parse("super 1").should == [:super, [:arglist, [:int, 1]]]
    opal_parse("super 1, 2").should == [:super, [:arglist, [:int, 1], [:int, 2]]]
    opal_parse("super 1, *2").should == [:super, [:arglist, [:int, 1], [:splat, [:int, 2]]]]
  end

  it "should set nil for args when no arguments or parans" do
    opal_parse("super").should == [:super, nil]
  end

  it "should always return s(:super) with :arglist when parans are used" do
    opal_parse("super()").should == [:super, [:arglist]]
    opal_parse("super(1)").should == [:super, [:arglist, [:int, 1]]]
    opal_parse("super(1, 2)").should == [:super, [:arglist, [:int, 1], [:int, 2]]]
    opal_parse("super(1, *2)").should == [:super, [:arglist, [:int, 1], [:splat, [:int, 2]]]]
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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