Sha256: d5e7478cd850428ba8a0841592c0b60d15b3342ebc2f8b21b2b52da8ab176a3d

Contents?: true

Size: 865 Bytes

Versions: 4

Compression:

Stored size: 865 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

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

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

  it "should always return s(:super) with :arglist when parans are used" do
    parsed("super()").should == [:super, [:arglist]]
    parsed("super(1)").should == [:super, [:arglist, [:int, 1]]]
    parsed("super(1, 2)").should == [:super, [:arglist, [:int, 1], [:int, 2]]]
    parsed("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.6.3 spec/cli/parser/super_spec.rb
opal-0.6.2 spec/cli/parser/super_spec.rb
opal-0.6.1 spec/cli/parser/super_spec.rb
opal-0.6.0 spec/cli/parser/super_spec.rb