#!/usr/bin/env ruby
# $Id: tc_ext_diff.rb,v 1.1 2004/05/12 18:26:04 eto Exp $
# Copyright (C) 2003-2004 Kouichirou Eto, All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
# You can redistribute it and/or modify it under the terms of the GNU GPL2.

$LOAD_PATH.unshift("../../lib")
$LOAD_PATH.unshift("../../compat")
require "test/unit"
require "qwik/ext_diff"

class TC_Diff < Test::Unit::TestCase
  def test_diff
    assert_equal('[[:+, 1, "t"]]', Diff.diff("t", "tt").inspect)
    assert_equal('[[:-, 1, "t"]]', Diff.diff("tt", "t").inspect)
  end
end

class TC_DiffHtmlGenerator < Test::Unit::TestCase
  def test_diff
    r = Qwik::DiffHtmlGenerator.new("t", "tt").to_rexml
    assert_equal("<div><del>t</del><br/><ins>tt</ins><br/></div>", r.to_s)
    newstr = <<"EOS"
a
z
c
EOS
    curstr = <<"EOS"
a
b
c
EOS
    r = Qwik::DiffHtmlGenerator.new(newstr, curstr).to_rexml
    assert_equal("<div>a<br/><del>z</del><br/><ins>b</ins><br/>c<br/></div>", r.to_s)

  end
end

#class TC_HTMLFormatter < Test::Unit::TestCase
#  include TestSite
#end
