Sha256: 4c85893f4b89acfe64791993469e8bb8ee39b57c2f1300c74662eff65e9b6ba9

Contents?: true

Size: 842 Bytes

Versions: 39

Compression:

Stored size: 842 Bytes

Contents

require 'support/parser_helpers'

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

39 entries across 39 versions & 3 rubygems

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