<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,3 +1,4 @@
 pkg
 .DS_Store
-config/*.yml
\ No newline at end of file
+config/*.yml
+*.tmproj
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,20 +1,19 @@
 Copyright (c) 2008 Tom Locke, Nic Williams, Duane Johnson
 
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-&quot;Software&quot;), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the &quot;Software&quot;), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
 
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
 
-THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file</diff>
      <filename>License.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,8 +1,10 @@
-Ruby DocTest
-=== 
+# Ruby DocTest
 
-Special Directives
----
+Comments and tests go together.
+
+## Special Directives
+
+Special directives are keywords that do something outside of the usual eval/result/compare loop.  They have to go at the beginning of a line (or after a #) if Ruby DocTest is to detect it as a special directive.  See below for a list of all special directives.
 
 ### The &quot;doctest:&quot; Directive
 
@@ -26,6 +28,8 @@ Type 'exit' at the irb prompt to continue through the rest of the tests.
 
 *Note:* You will probably have to test this file using the rubydoctest command, rather than an editor shortcut (such as TextMate's).
 
+There is a special variable, $rubydoctest, available inside the irb session which you can use to access the 'current instance' of the RubyDocTest::Runner object.  This is probably only useful for debugging.
+
 ### The &quot;doctest_require:&quot; Directive
 
 Ruby source files are evaluated once before the RubyDocTest::Runner goes through and evaluates each irb session prompt.  This is necessary so that all of the classes, variables, and methods (and so on) that are defined in the file get loaded into memory--i.e. it is necessary so they can be tested.
@@ -44,4 +48,13 @@ Unlike the regular 'require' method in ruby, 'doctest_require' expects &quot;my-helpe
 	doctest_require: $mysql_fixture_file = &quot;test/fixtures/memorypress.sql&quot;
 	                 nil
 
-assigns a string to a global variable, and then returns nil so that doctest_require does not load/require any files.
\ No newline at end of file
+assigns a string to a global variable, and then returns nil so that doctest_require does not load/require any files.
+
+## Miscellaneous
+
+### The $rubydoctest variable
+
+If you open an irb session using the !!! special directive, a $rubydoctest global variable will be available to the context.  Here is a short list of example uses for this variable:
+
+	puts $rubydoctest.blocks.map{|g| g.lines.join(&quot;\n&quot;)}.join(&quot;\n---\n&quot;)
+</diff>
      <filename>doc/special_directives.doctest</filename>
    </modified>
    <modified>
      <diff>@@ -40,11 +40,16 @@ module RubyDocTest
     # &gt;&gt; cb.pass?
     # =&gt; true
     def pass?
-      @passed ||=
-        begin
-          actual_results = @statements.map{ |s| s.evaluate }
-          @result ? @result.matches?(actual_results.last) : true
-        end
+      if @computed
+        @passed
+      else
+        @computed = true
+        @passed =
+          begin
+            actual_results = @statements.map{ |s| s.evaluate }
+            @result ? @result.matches?(actual_results.last) : true
+          end
+      end
     end
     
     def actual_result
@@ -54,5 +59,10 @@ module RubyDocTest
     def expected_result
       @result.expected_result
     end
+    
+    def lines
+      @statements.map{ |s| s.lines }.flatten +
+      @result.lines
+    end
   end
 end
\ No newline at end of file</diff>
      <filename>lib/code_block.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,13 +52,10 @@ module RubyDocTest
     # &gt;&gt; r.matches?({:two =&gt; 2, :one =&gt; 1})
     # =&gt; true
     def matches?(actual_result)
-      actual_result = actual_result.inspect
-      
-      normalize_result(expected_result) ==
-      normalize_result(actual_result) \
+      normalize_result(actual_result.inspect) ==
+      normalize_result(expected_result) \
         or
-      eval(expected_result, TOPLEVEL_BINDING) ==
-      eval(actual_result, TOPLEVEL_BINDING)
+      actual_result == eval(expected_result, TOPLEVEL_BINDING)
     rescue Exception
       false
     end</diff>
      <filename>lib/result.rb</filename>
    </modified>
    <modified>
      <diff>@@ -64,6 +64,7 @@ module RubyDocTest
       
       @src_lines = src.split(&quot;\n&quot;)
       @groups, @blocks = [], []
+      $rubydoctest = self
     end
     
     # doctest: Using the doctest_require: SpecialDirective should require a file relative to the current one.
@@ -295,10 +296,10 @@ module RubyDocTest
             blocks &lt;&lt; CodeBlock.new(current_statements) unless current_statements.empty?
             current_statements = []
           when &quot;doctest_require:&quot;
-            $:.unshift(@file_name)
-            ruby = eval(g.value, TOPLEVEL_BINDING, @file_name, g.line_number)
-            require ruby if ruby
-            $:.shift
+            doctest_require = eval(g.value, TOPLEVEL_BINDING, @file_name, g.line_number)
+            if doctest_require.is_a? String
+              require_relative_to_file_name(doctest_require, @file_name)
+            end
           when &quot;!!!&quot;
             # ignore
           end
@@ -309,6 +310,14 @@ module RubyDocTest
       blocks
     end
     
+    def require_relative_to_file_name(file_name, relative_to)
+      load_path = $:.dup
+      $:.unshift File.expand_path(File.join(File.dirname(relative_to), File.dirname(file_name)))
+      require File.basename(file_name)
+    ensure
+      $:.shift
+    end
+    
     # === Tests
     # 
     # doctest: Tests should be organized into groups based on the 'doctest' SpecialDirective</diff>
      <filename>lib/runner.rb</filename>
    </modified>
    <modified>
      <diff>@@ -66,7 +66,7 @@ module RubyDocTest
       @actual_result = eval(sc, TOPLEVEL_BINDING, __FILE__, __LINE__)
     rescue Exception =&gt; e
       if RubyDocTest.trace
-        raise
+        raise e.class, e.to_s + &quot;\n&quot; + e.backtrace.first
       else
         raise EvaluationError.new(self, e)
       end</diff>
      <filename>lib/statement.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>95b4fa6924e63dbcb80405e3cb9b131902d414db</id>
    </parent>
  </parents>
  <author>
    <name>Duane Johnson</name>
    <email>duane.johnson@gmail.com</email>
  </author>
  <url>http://github.com/tablatom/rubydoctest/commit/aab168fdb48a14adc8896e78f252e0130c4c3eed</url>
  <id>aab168fdb48a14adc8896e78f252e0130c4c3eed</id>
  <committed-date>2008-06-20T19:02:48-07:00</committed-date>
  <authored-date>2008-06-20T19:02:48-07:00</authored-date>
  <message>Fixed that in some cases, tests were being evaluated more than once. Added  variable to documenation. Improved trace output when --trace option is given.</message>
  <tree>90048b9e2f8722d5f7a6e3b04f5fc4c30b9a42be</tree>
  <committer>
    <name>Duane Johnson</name>
    <email>duane.johnson@gmail.com</email>
  </committer>
</commit>
