Sha256: 6bd3f33ac35b7e2574df995f3ca60b5328a819acd5b20d15b6563390fcccb46d

Contents?: true

Size: 847 Bytes

Versions: 60

Compression:

Stored size: 847 Bytes

Contents

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

describe "Array.[]" do
  it "returns a new array populated with the given elements" do
    obj = Object.new
    Array.[](5, true, nil, 'a', "Ruby", obj).should == [5, true, nil, "a", "Ruby", obj]

    a = ArraySpecs::MyArray.[](5, true, nil, 'a', "Ruby", obj)
    a.should be_kind_of(ArraySpecs::MyArray)
    a.inspect.should == [5, true, nil, "a", "Ruby", obj].inspect
  end
end

describe "Array[]" do
  it "is a synonym for .[]" do
    obj = Object.new
    Array[5, true, nil, 'a', "Ruby", obj].should == Array.[](5, true, nil, "a", "Ruby", obj)

    a = ArraySpecs::MyArray[5, true, nil, 'a', "Ruby", obj]
    a.should be_kind_of(ArraySpecs::MyArray)
    a.inspect.should == [5, true, nil, "a", "Ruby", obj].inspect
  end
end

Version data entries

60 entries across 60 versions & 3 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-7.5.1 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-7.4.1 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-7.1.17 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-6.2.0 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-6.0.11 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.18 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.17 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.15 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.2 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/core/array/constructor_spec.rb
rhodes-5.5.0 spec/framework_spec/app/spec/core/array/constructor_spec.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/core/array/constructor_spec.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/core/array/constructor_spec.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/core/array/constructor_spec.rb
opal-0.4.4 spec/rubyspec/core/array/constructor_spec.rb
opal-0.4.3 spec/rubyspec/core/array/constructor_spec.rb
opal-0.4.2 spec/rubyspec/core/array/constructor_spec.rb