<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,7 +1,8 @@
 #!/usr/bin/env ruby
 # The command line Haml parser.
 
-require File.dirname(__FILE__) + '/../lib/haml'
+$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
+require 'haml'
 require 'haml/exec'
 
 opts = Haml::Exec::Haml.new(ARGV)</diff>
      <filename>bin/haml</filename>
    </modified>
    <modified>
      <diff>@@ -68,6 +68,7 @@ module Haml
         :escape_html =&gt; false
       }
       @options.merge! options
+      @index = 0
 
       unless [:xhtml, :html4, :html5].include?(@options[:format])
         raise Haml::Error, &quot;Invalid format #{@options[:format].inspect}&quot;
@@ -77,8 +78,8 @@ module Haml
       @to_close_stack = []
       @output_tabs = 0
       @template_tabs = 0
-      @index = 0
       @flat_spaces = -1
+      @flat = false
       @newlines = 0
       @precompiled = ''
       @merged_text = ''</diff>
      <filename>lib/haml/engine.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,3 @@
-require File.dirname(__FILE__) + '/../haml'
 require 'optparse'
 require 'fileutils'
 </diff>
      <filename>lib/haml/exec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@ module Haml
       def self.included(base) # :nodoc:
         Filters.defined[base.name.split(&quot;::&quot;).last.downcase] = base
         base.extend(base)
+        base.instance_variable_set &quot;@lazy_requires&quot;, nil
       end
 
       # Takes a string, the source text that should be passed to the filter,</diff>
      <filename>lib/haml/filters.rb</filename>
    </modified>
    <modified>
      <diff>@@ -397,7 +397,7 @@ module Haml
     def capture_haml_with_buffer(local_buffer, *args, &amp;block)
       position = local_buffer.length
 
-      block.call *args
+      block.call(*args)
 
       captured = local_buffer.slice!(position..-1)
 </diff>
      <filename>lib/haml/helpers.rb</filename>
    </modified>
    <modified>
      <diff>@@ -112,6 +112,8 @@ END
     Line = Struct.new(:text, :unstripped, :index, :spaces, :tabs)
 
     def precompile
+      @haml_comment = @dont_indent_next_line = @dont_tab_up_next_text = false
+      @indentation = nil
       old_line = Line.new
       @template.split(/\r\n|\r|\n/).each_with_index do |text, index|
         @next_line = line = Line.new(text.strip, text.lstrip.chomp, index)</diff>
      <filename>lib/haml/precompiler.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,7 +8,7 @@ module Sass::Constant  # :nodoc:
     def parse(value)
       first, second, unit = value.scan(Literal::NUMBER)[0]
       @value = first.empty? ? second.to_i : &quot;#{first}#{second}&quot;.to_f
-      @unit = unit unless unit.empty?
+      @unit = unit.empty? ? nil : unit
     end
 
     def plus(other)</diff>
      <filename>lib/sass/constant/number.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 require File.dirname(__FILE__) + '/../test_helper'
 
 class EngineTest &lt; Test::Unit::TestCase
-  # A map of erroneous Sass documents to the error messages they should produce.
+  # A map of erroneous Haml documents to the error messages they should produce.
   # The error messages may be arrays;
   # if so, the second element should be the line number that should be reported for the error.
   # If this isn't provided, the tests will assume the line number should be the last line of the document.
@@ -34,13 +34,7 @@ END
     &quot;%a/ b&quot; =&gt; &quot;Self-closing tags can't have content.&quot;,
     &quot; %p foo&quot; =&gt; &quot;Indenting at the beginning of the document is illegal.&quot;,
     &quot;  %p foo&quot; =&gt; &quot;Indenting at the beginning of the document is illegal.&quot;,
-    &quot;- end&quot; =&gt; &lt;&lt;END.rstrip,
-You don't need to use &quot;- end&quot; in Haml. Use indentation instead:
-- if foo?
-  %strong Foo!
-- else
-  Not foo.
-END
+    &quot;- end&quot; =&gt; &quot;You don't need to use \&quot;- end\&quot; in Haml. Use indentation instead:\n- if foo?\n  %strong Foo!\n- else\n  Not foo.&quot;,
     &quot; \n\t\n %p foo&quot; =&gt; [&quot;Indenting at the beginning of the document is illegal.&quot;, 3],
 
     # Regression tests
@@ -64,9 +58,19 @@ END
   def render(text, options = {}, &amp;block)
     scope  = options.delete(:scope)  || Object.new
     locals = options.delete(:locals) || {}
-    Haml::Engine.new(text, options).to_html(scope, locals, &amp;block)
+    engine(text, options).to_html(scope, locals, &amp;block)
   end
-
+  
+  def engine(text, options = {})
+    unless options[:filename]
+      # use caller method name as fake filename. useful for debugging
+      i = -1
+      caller[i+=1] =~ /`(.+?)'/ until $1 and $1.index('test_') == 0
+      options[:filename] = &quot;(#{$1})&quot;
+    end
+    Haml::Engine.new(text, options)
+  end
+  
   def test_empty_render_should_remain_empty
     assert_equal('', render(''))
   end
@@ -99,7 +103,7 @@ END
   end
 
   def test_multi_render
-    engine = Haml::Engine.new(&quot;%strong Hi there!&quot;)
+    engine = engine(&quot;%strong Hi there!&quot;)
     assert_equal(&quot;&lt;strong&gt;Hi there!&lt;/strong&gt;\n&quot;, engine.to_html)
     assert_equal(&quot;&lt;strong&gt;Hi there!&lt;/strong&gt;\n&quot;, engine.to_html)
     assert_equal(&quot;&lt;strong&gt;Hi there!&lt;/strong&gt;\n&quot;, engine.to_html)
@@ -270,14 +274,14 @@ SOURCE
       render(&quot;\n\n = abc&quot;, :filename =&gt; 'test', :line =&gt; 2)
     rescue Exception =&gt; e
       assert_kind_of Haml::SyntaxError, e
-      assert_match /test:4/, e.backtrace.first
+      assert_match(/test:4/, e.backtrace.first)
     end
 
     begin
       render(&quot;\n\n= 123\n\n= nil[]&quot;, :filename =&gt; 'test', :line =&gt; 2)
     rescue Exception =&gt; e
       assert_kind_of NoMethodError, e
-      assert_match /test:6/, e.backtrace.first
+      assert_match(/test:6/, e.backtrace.first)
     end
   end
 
@@ -364,12 +368,15 @@ SOURCE
   def test_exceptions
     EXCEPTION_MAP.each do |key, value|
       begin
-        render(key)
+        render(key, :filename =&gt; &quot;(exception test for #{key.inspect})&quot;)
       rescue Exception =&gt; err
         value = [value] unless value.is_a?(Array)
+        expected_message, line_no = value
+        line_no ||= key.split(&quot;\n&quot;).length
+        line_reported = err.backtrace[0].gsub(/\(.+\):/, '').to_i
 
-        assert_equal(value.first, err.message, &quot;Line: #{key}&quot;)
-        assert_equal(value[1] || key.split(&quot;\n&quot;).length, err.backtrace[0].gsub('(haml):', '').to_i, &quot;Line: #{key}&quot;)
+        assert_equal(expected_message, err.message, &quot;Line: #{key}&quot;)
+        assert_equal(line_no, line_reported, &quot;Line: #{key}&quot;)
       else
         assert(false, &quot;Exception not raised for\n#{key}&quot;)
       end
@@ -379,7 +386,7 @@ SOURCE
   def test_exception_line
     render(&quot;a\nb\n!!!\n  c\nd&quot;)
   rescue Haml::SyntaxError =&gt; e
-    assert_equal(&quot;(haml):4&quot;, e.backtrace[0])
+    assert_equal(&quot;(test_exception_line):4&quot;, e.backtrace[0])
   else
     assert(false, '&quot;a\nb\n!!!\n  c\nd&quot; doesn\'t produce an exception')
   end
@@ -387,7 +394,7 @@ SOURCE
   def test_exception
     render(&quot;%p\n  hi\n  %a= undefined\n= 12&quot;)
   rescue Exception =&gt; e
-    assert_match(&quot;(haml):3&quot;, e.backtrace[0])
+    assert_match(&quot;(test_exception):3&quot;, e.backtrace[0])
   else
     # Test failed... should have raised an exception
     assert(false)
@@ -396,7 +403,7 @@ SOURCE
   def test_compile_error
     render(&quot;a\nb\n- fee)\nc&quot;)
   rescue Exception =&gt; e
-    assert_match(/^compile error\n\(haml\):3: syntax error/i, e.message)
+    assert_match(/^compile error\n\(test_compile_error\):3: syntax error/i, e.message)
   else
     assert(false,
            '&quot;a\nb\n- fee)\nc&quot; doesn\'t produce an exception!')
@@ -471,28 +478,28 @@ END
 
   def test_yield_should_work_with_def_method
     s = &quot;foo&quot;
-    Haml::Engine.new(&quot;= yield\n= upcase&quot;).def_method(s, :render)
+    engine(&quot;= yield\n= upcase&quot;).def_method(s, :render)
     assert_equal(&quot;12\nFOO\n&quot;, s.render { 12 })
   end
 
   def test_def_method_with_module
-    Haml::Engine.new(&quot;= yield\n= upcase&quot;).def_method(String, :render_haml)
+    engine(&quot;= yield\n= upcase&quot;).def_method(String, :render_haml)
     assert_equal(&quot;12\nFOO\n&quot;, &quot;foo&quot;.render_haml { 12 })
   end
 
   def test_def_method_locals
     obj = Object.new
-    Haml::Engine.new(&quot;%p= foo\n.bar{:baz =&gt; baz}= boom&quot;).def_method(obj, :render, :foo, :baz, :boom)
+    engine(&quot;%p= foo\n.bar{:baz =&gt; baz}= boom&quot;).def_method(obj, :render, :foo, :baz, :boom)
     assert_equal(&quot;&lt;p&gt;1&lt;/p&gt;\n&lt;div baz='2' class='bar'&gt;3&lt;/div&gt;\n&quot;, obj.render(:foo =&gt; 1, :baz =&gt; 2, :boom =&gt; 3))
   end
 
   def test_render_proc_locals
-    proc = Haml::Engine.new(&quot;%p= foo\n.bar{:baz =&gt; baz}= boom&quot;).render_proc(Object.new, :foo, :baz, :boom)
+    proc = engine(&quot;%p= foo\n.bar{:baz =&gt; baz}= boom&quot;).render_proc(Object.new, :foo, :baz, :boom)
     assert_equal(&quot;&lt;p&gt;1&lt;/p&gt;\n&lt;div baz='2' class='bar'&gt;3&lt;/div&gt;\n&quot;, proc[:foo =&gt; 1, :baz =&gt; 2, :boom =&gt; 3])
   end
 
   def test_render_proc_with_binding
-    assert_equal(&quot;FOO\n&quot;, Haml::Engine.new(&quot;= upcase&quot;).render_proc(&quot;foo&quot;.instance_eval{binding}).call)
+    assert_equal(&quot;FOO\n&quot;, engine(&quot;= upcase&quot;).render_proc(&quot;foo&quot;.instance_eval{binding}).call)
   end
 
   def test_ugly_true
@@ -519,7 +526,7 @@ END
   end
 
   def test_arbitrary_output_option
-    assert_raise(Haml::Error, &quot;Invalid output format :html1&quot;) { Haml::Engine.new(&quot;%br&quot;, :format =&gt; :html1) }
+    assert_raise(Haml::Error, &quot;Invalid output format :html1&quot;) { engine(&quot;%br&quot;, :format =&gt; :html1) }
   end
 
   # HTML 4.0
@@ -548,7 +555,7 @@ END
 
   # because anything before the doctype triggers quirks mode in IE
   def test_xml_prolog_and_doctype_dont_result_in_a_leading_whitespace_in_html
-    assert_no_match /^\s+/, render(&quot;!!! xml\n!!!&quot;, :format =&gt; :html4)
+    assert_no_match(/^\s+/, render(&quot;!!! xml\n!!!&quot;, :format =&gt; :html4))
   end
 
   # HTML5</diff>
      <filename>test/haml/engine_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,7 +52,8 @@ class Html2HamlTest &lt; Test::Unit::TestCase
     end
 
     def assert_equal_attributes(expected, result)
-      assert_equal *[expected, result].map { |s| s.gsub!(/\{ (.+) \}/, ''); $1.split(', ').sort }
+      expected_attr, result_attr = [expected, result].map { |s| s.gsub!(/\{ (.+) \}/, ''); $1.split(', ').sort }
+      assert_equal expected_attr, result_attr
       assert_equal expected, result
     end
 end</diff>
      <filename>test/haml/html2haml_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -151,5 +151,6 @@ class Sass::Engine
 end
 
 class ActionController::Base
+  undef :sass_old_process
   def sass_old_process(*args); end
 end</diff>
      <filename>test/sass/plugin_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+lib_dir = File.dirname(__FILE__) + '/../lib'
 # allows testing with edge Rails by creating a test/rails symlink
 linked_rails = File.dirname(__FILE__) + '/rails'
 
@@ -12,5 +13,6 @@ require 'action_controller'
 require 'action_view'
 
 require 'test/unit'
-require File.dirname(__FILE__) + '/../lib/haml'
-require File.dirname(__FILE__) + '/../lib/sass'
+$:.unshift lib_dir unless $:.include?(lib_dir)
+require 'haml'
+require 'sass'</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>fceeccea32ccc12affb50f21247ce17bf30f99c4</id>
    </parent>
  </parents>
  <author>
    <name>Mislav Marohni&#263;</name>
    <email>mislav.marohnic@gmail.com</email>
  </author>
  <url>http://github.com/mislav/haml/commit/429314d2b0da220065e5d888d501ad9d0f0e9e7b</url>
  <id>429314d2b0da220065e5d888d501ad9d0f0e9e7b</id>
  <committed-date>2008-08-29T18:50:32-07:00</committed-date>
  <authored-date>2008-08-29T17:40:59-07:00</authored-date>
  <message>avoid some warnings thrown by the Ruby interpreter</message>
  <tree>dab8a1ce55711caa04fb58787b8bd69bccb4e629</tree>
  <committer>
    <name>Nathan Weizenbaum</name>
    <email>nex342@gmail.com</email>
  </committer>
</commit>
