mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
passing ALL tests now for 1.8 AND 1.9
This commit is contained in:
parent
06aa0b9bbc
commit
00ec4c84d3
3 changed files with 15 additions and 5 deletions
|
@ -244,7 +244,6 @@ class Pry
|
|||
else
|
||||
true
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def binding_for(target)
|
||||
|
|
17
test/test.rb
17
test/test.rb
|
@ -1,9 +1,12 @@
|
|||
direc = File.dirname(__FILE__)
|
||||
|
||||
require 'rubygems'
|
||||
require 'bacon'
|
||||
require "#{direc}/../lib/pry"
|
||||
require "#{direc}/test_helper"
|
||||
|
||||
NOT_FOR_RUBY_18 = [/show_doc/, /show_idoc/, /show_method/, /show_imethod/]
|
||||
|
||||
describe Pry do
|
||||
describe "open a Pry session on an object" do
|
||||
describe "rep" do
|
||||
|
@ -48,7 +51,7 @@ describe Pry do
|
|||
output = OutputTester.new
|
||||
pry_tester = Pry.new(InputTester.new("class Nested", "end"), output)
|
||||
pry_tester.rep(Hello)
|
||||
Hello.const_defined?(:Nested, false).should == true
|
||||
Hello.const_defined?(:Nested).should == true
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -107,15 +110,19 @@ describe Pry do
|
|||
"cat dummy" => "cat",
|
||||
"cd 3" => "cd",
|
||||
"ls" => "ls",
|
||||
"jump_to 0" => "jump_to",
|
||||
"show_method test_method" => "show_method",
|
||||
"show_imethod test_method" => "show_method",
|
||||
"show_doc test_method" => "show_doc",
|
||||
"show_idoc test_method" => "show_doc",
|
||||
"jump_to 0" => "jump_to"
|
||||
"show_idoc test_method" => "show_doc"
|
||||
}
|
||||
|
||||
commands.each do |command, meth|
|
||||
|
||||
if RUBY_VERSION =~ /1.8/ && NOT_FOR_RUBY_18.any? { |v| v =~ command }
|
||||
next
|
||||
end
|
||||
|
||||
eval %{
|
||||
it "should invoke output##{meth} when #{command} command entered" do
|
||||
input_strings = ["#{command}", "exit"]
|
||||
|
@ -134,6 +141,10 @@ describe Pry do
|
|||
|
||||
commands.each do |command, meth|
|
||||
|
||||
if RUBY_VERSION =~ /1.8/ && NOT_FOR_RUBY_18.include?(command)
|
||||
next
|
||||
end
|
||||
|
||||
eval %{
|
||||
it "should raise when trying to invoke #{command} command with preceding whitespace" do
|
||||
input_strings = [" #{command}", "exit"]
|
||||
|
|
|
@ -30,7 +30,7 @@ class OutputTester
|
|||
end
|
||||
|
||||
def method_missing(meth_name, *args, &block)
|
||||
define_singleton_method("#{meth_name}_invoked") { true }
|
||||
class << self; self; end.send(:define_method, "#{meth_name}_invoked") { true }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue