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
else
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]
stagger_output(text)

View File

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