On Thursday 09 June 2005 06:38 pm, Andrew Cox wrote:
> def initialize(fileName, logsToKeep, maxLogSize, xmlFileName )
> @logfile = File.new(xmlFileName, "w")
> @xml = XmlMarkup.new(:target=>@logfile, :indent=>2)
> @xml.instruct! #insert processing instruction
> @results = XmlMarkup.new
> end
>
> def log_results(name, input, expected, test_status)
> r = XmlMarkup.new(:target=>@results, :indent=>2)
> r.result(:testcase => name) do
> r.status(test_status)
> end #results tag
> end #log_results
>
> def end_log
> @xml.results do
> @results
> end
> @logfile.close
> end #end_log

The following should work for you:

class TestResultsLogger
  def initialize(fileName, logsToKeep, maxLogSize, xmlFileName )
    @logfile = File.new(xmlFileName, "w")
    @xml = Builder::XmlMarkup.new(:target=>@logfile, :indent=>2)
    @xml.instruct! #insert processing instruction
    @results = 
Builder::XmlMarkup.new(:target=>@results, :indent=>2, :margin=>1)
  end
  
  def log_results(name, input, expected, test_status)
    @results.result(:testcase => name) do
      @results.status(test_status)
    end
  end
  
  def end_log
    @xml.results do
      @xml << @results.target!
    end
    @logfile.close
  end
end

-- 
-- Jim Weirich    jim / weirichhouse.org     http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct, 
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)