Sha256: 5e62146d882bc62b7819d6760d402bd6d6bba297b20ab01175befdedf1f476b7

Contents?: true

Size: 1.24 KB

Versions: 64

Compression:

Stored size: 1.24 KB

Contents

require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper'
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes'

describe "Array#to_s" do
  ruby_version_is "" .. "1.9" do
    it "is equivalent to #join without a separator string" do
      old = $,
      begin
        a = [1, 2, 3, 4]
        a.to_s.should == a.join
        $, = '-'
        a.to_s.should == a.join
      ensure
        $, = old
      end
    end

    it "returns '[...]' for an empty array embedded in itself" do
      ArraySpecs.empty_recursive_array.to_s.should == "[...]"
    end

    ruby_bug "[ruby-dev:37019]", "1.8.6.319" do
      it "returns '[...]' for the embedded array in a recursive array" do
        a = [1, 2, 3]; a << a
        a.to_s.should == "123[...]"
      end
    end
  end

  ruby_version_is "1.9" do
    it "is equivalent to Array#inspect" do
      a = [1, 2, 3, 4]
      a.to_s.should == a.inspect
    end

    # This test fails on mainline Ruby 1.9
=begin
    it "is equivalent to Array#inspect in a recursive array" do
      a = [1, 2, 3, 4]; a << a
      a.to_s.should == a.inspect

      a = ArraySpecs.empty_recursive_array
      a.to_s.should == "[[...]]"
      a.inspect == "[[...]]"
    end
=end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
rhodes-3.1.1 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.1.beta spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0.beta.5 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0.beta.4 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0.beta.3 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0.beta.2 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.1.0.beta.1 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.2 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.2.beta.1 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.8 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.7 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.6 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.5 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.4 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.3 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.1.beta.2 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.0 spec/framework_spec/app/spec/core/array/to_s_spec.rb
rhodes-3.0.0.beta.7 spec/framework_spec/app/spec/core/array/to_s_spec.rb