#!/usr/bin/env ruby
# $Id: tc_webrick.rb,v 1.2 2004/04/16 14:39:08 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 'webrick'
require 'qwik/webrick'

class TC_HTTPUtils < Test::Unit::TestCase
  def test_parse
    assert_equal('{"header"=>["content"]}',
		 WEBrick::HTTPUtils::parse_header("Header: content").inspect)
    assert_equal('{"~~~~~~~~~~"=>["~~~~~~~~~~"]}',
		 WEBrick::HTTPUtils::parse_header("~~~~~~~~~~: ~~~~~~~~~~\r\n").inspect)
    str = <<EOS
Accept: */*
Accept-Language: ja
~~~~~~~~~~: ~~~~~~~~~~
EOS
    assert_equal('{"~~~~~~~~~~"=>["~~~~~~~~~~"], "accept-language"=>["ja"], "accept"=>["*/*"]}',
		 WEBrick::HTTPUtils::parse_header(str).inspect)
  end
end
