1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/spec/ruby/library/set/shared/inspect.rb

16 lines
580 B
Ruby
Raw Normal View History

describe "set_inspect", shared: true do
it "returns a String representation of self" do
Set[].send(@method).should be_kind_of(String)
Set[nil, false, true].send(@method).should be_kind_of(String)
Set[1, 2, 3].send(@method).should be_kind_of(String)
Set["1", "2", "3"].send(@method).should be_kind_of(String)
Set[:a, "b", Set[?c]].send(@method).should be_kind_of(String)
end
it "correctly handles self-references" do
(set = Set[]) << set
set.send(@method).should be_kind_of(String)
set.send(@method).should include("#<Set: {...}>")
end
end