1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

updated tests for view_clip to reflect new behaviour (truncated #<> output)

This commit is contained in:
John Mair 2011-09-08 20:28:08 +12:00
parent 1759f282f4
commit 02addb1f73
2 changed files with 9 additions and 9 deletions

View file

@ -212,7 +212,7 @@ Shows local and instance variables by default.
# plain # plain
else else
list = info.sort_by { |k, v| v.last }.map { |k, v| [k, [v.first.grep(options[:grep])], v.last] } list = info.sort_by { |k, v| v.last }.map { |k, v| [k, [v.first.grep(options[:grep])], v.last] }
list = list.each { |k, v| text << text().send(ls_color_map[k], v.first.join(Pry.config.ls.separator)); text << " " } list = list.each { |k, v| text << text().send(ls_color_map[k], v.first.join(Pry.config.ls.separator)); text << Pry.config.ls.separator }
if !options[:f] if !options[:f]
stagger_output(text) stagger_output(text)

View file

@ -1131,7 +1131,7 @@ describe Pry do
o = Object.new o = Object.new
def o.inspect; "a" * VC_MAX_LENGTH; end def o.inspect; "a" * VC_MAX_LENGTH; end
Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
end end
end end
@ -1152,7 +1152,7 @@ describe Pry do
# only testing with String here :) # only testing with String here :)
it "returns #<> format of the special-cased immediate object if #inspect is longer than maximum" do it "returns #<> format of the special-cased immediate object if #inspect is longer than maximum" do
o = "o" * (VC_MAX_LENGTH + 1) o = "o" * (VC_MAX_LENGTH + 1)
Pry.view_clip(o, VC_MAX_LENGTH).should =~ /String:0x.*?/ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<String/
end end
end end
@ -1161,7 +1161,7 @@ describe Pry do
o = Object.new o = Object.new
def o.inspect; "a" * VC_MAX_LENGTH; end def o.inspect; "a" * VC_MAX_LENGTH; end
Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
end end
end end
@ -1172,7 +1172,7 @@ describe Pry do
o = Object.new o = Object.new
def o.inspect; "a" * (VC_MAX_LENGTH + 1); end def o.inspect; "a" * (VC_MAX_LENGTH + 1); end
Pry.view_clip(o, VC_MAX_LENGTH).should =~ /Object:0x.*?/ Pry.view_clip(o, VC_MAX_LENGTH).should =~ /#<Object/
end end
end end
@ -1181,8 +1181,8 @@ describe Pry do
it "returns a string of the #<class name:object idish> format" do it "returns a string of the #<class name:object idish> format" do
c, m = Class.new, Module.new c, m = Class.new, Module.new
Pry.view_clip(c, VC_MAX_LENGTH).should =~ /Class:0x.*?/ Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
Pry.view_clip(m, VC_MAX_LENGTH).should =~ /Module:0x.*?/ Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
end end
end end
@ -1194,8 +1194,8 @@ describe Pry do
def c.name; "a" * (VC_MAX_LENGTH + 1); end def c.name; "a" * (VC_MAX_LENGTH + 1); end
def m.name; "a" * (VC_MAX_LENGTH + 1); end def m.name; "a" * (VC_MAX_LENGTH + 1); end
Pry.view_clip(c, VC_MAX_LENGTH).should =~ /Class:0x.*?/ Pry.view_clip(c, VC_MAX_LENGTH).should =~ /#<Class/
Pry.view_clip(m, VC_MAX_LENGTH).should =~ /Module:0x.*?/ Pry.view_clip(m, VC_MAX_LENGTH).should =~ /#<Module/
end end
end end