Sha256: 1bcdd32036978242d0c25a298cb8e3a9725cfde7fda21682d81dc3f4cb11c7e4
Contents?: true
Size: 1.16 KB
Versions: 83
Compression:
Stored size: 1.16 KB
Contents
require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/../../spec_helper' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/fixtures/classes' require File.dirname(File.join(__rhoGetCurrentDir(), __FILE__)) + '/shared/to_s' describe "Hash#inspect" do it_behaves_like :to_s, :inspect # FIXME: When http://redmine.ruby-lang.org/issues/show/1533 is fixed, this # block can be removed, as the behaviour will then be shared with to_s # completely. it "handles recursive hashes" do x = new_hash x[0] = x x.inspect.should == '{0=>{...}}' x = new_hash x[x] = 0 x.inspect.should == '{{...}=>0}' x = new_hash x[x] = x x.inspect.should == '{{...}=>{...}}' x = new_hash y = new_hash x[0] = y y[1] = x x.inspect.should == "{0=>{1=>{...}}}" y.inspect.should == "{1=>{0=>{...}}}" x = new_hash y = new_hash x[y] = 0 y[x] = 1 x.inspect.should == "{{{...}=>1}=>0}" y.inspect.should == "{{{...}=>0}=>1}" x = new_hash y = new_hash x[y] = x y[x] = y x.inspect.should == "{{{...}=>{...}}=>{...}}" y.inspect.should == "{{{...}=>{...}}=>{...}}" end end
Version data entries
83 entries across 83 versions & 1 rubygems