#!/usr/bin/env ruby
# Copyright (C) 2003-2005 Kouichirou Eto, All rights reserved.

$LOAD_PATH << "../../lib" unless $LOAD_PATH.include?("../../lib")
require "qwik/test-common"

#class TC_XPath < Test::Unit::TestCase
class TC_XPath
  include TestSession

  def test_xpath
    t_add_user
    page = @site.create_new
    page.store("t")

    session("/test/1.html")
    px("//div[@class='section']", 0)

    require "xml/xpath"
    xpath = XML::XPATH.new
#   xpath.xml = @res.body.to_s.sjistou8
    xpath.xml = @res.body.format_xml.sjistou8
    i = xpath.execute("//div[@class='section']/p")
    print "#{i} nodes :\n"
    p xpath.to_a
  end
end
