anchor.diff:         mochiweb_html:parse("<html>"
                              "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
                              "<head></head></body></html>")),
  -    ok.
  -
  +    %% http://github.com/mochi/mochiweb/pull/13
  +    ?assertEqual(
  +       {<<"html">>,[],[{<<"head">>,[],[]}]},
  +       mochiweb_html:parse("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"/>"
  +                           "<html>"
  +                           "<head></head></body></html>")),
  +    ok.
  +
  +dumb_br_test() ->
  +    %% http://code.google.com/p/mochiweb/issues/detail?id=71
  +    ?assertEqual(
  +       {<<"div">>,[],[{<<"br">>, [], []}, {<<"br">>, [], []}, <<"z">>]},
  +       mochiweb_html:parse("<div><br/><br/>z</br/></br/></div>")),
  +    ?assertEqual(
  +       {<<"div">>,[],[{<<"br">>, [], []}, {<<"br">>, [], []}, <<"z">>]},
  +       mochiweb_html:parse("<div><br><br>z</br/></br/></div>")),
  +    ?assertEqual(
  +       {<<"div">>,[],[{<<"br">>, [], []}, {<<"br">>, [], []}, <<"z">>, {<<"br">>, [], []}, {<<"br">>, [], []}]},
  +       mochiweb_html:parse("<div><br><br>z<br/><br/></div>")),
  +    ?assertEqual(
  +       {<<"div">>,[],[{<<"br">>, [], []}, {<<"br">>, [], []}, <<"z">>]},
  +       mochiweb_html:parse("<div><br><br>z</br></br></div>")).
  +
  +
  +php_test() ->
  +    %% http://code.google.com/p/mochiweb/issues/detail?id=71
  +    ?assertEqual(
  +       [{pi, <<"php\n">>}],
  +       mochiweb_html:tokens(
  +         "<?php\n?>")),
  +    ?assertEqual(
  +       {<<"div">>, [], [{pi, <<"php\n">>}]},
  +       mochiweb_html:parse(
  +         "<div><?php\n?></div>")),
  +    ok.
  +
  +parse_unquoted_attr_test() ->
  +    D0 = <<"<html><img src=/images/icon.png/></html>">>,
  +    ?assertEqual(
  +        {<<"html">>,[],[
  +            { <<"img">>, [ { <<"src">>, <<"/images/icon.png">> } ], [] }
  +        ]},
  +        mochiweb_html:parse(D0)),
  +    
  +    D1 = <<"<html><img src=/images/icon.png></img></html>">>,
  +        ?assertEqual(
  +            {<<"html">>,[],[
  +                { <<"img">>, [ { <<"src">>, <<"/images/icon.png">> } ], [] }
  +            ]},
  +            mochiweb_html:parse(D1)),
  +    
  +    D2 = <<"<html><img src=/images/icon&gt;.png width=100></img></html>">>,
  +        ?assertEqual(
  +            {<<"html">>,[],[
  +                { <<"img">>, [ { <<"src">>, <<"/images/icon>.png">> }, { <<"width">>, <<"100">> } ], [] }
  +            ]},
  +            mochiweb_html:parse(D2)),
  +    ok.        
  +    
  +parse_quoted_attr_test() ->    
  +    D0 = <<"<html><img src='/images/icon.png'></html>">>,
  +    ?assertEqual(
  +        {<<"html">>,[],[
  +            { <<"img">>, [ { <<"src">>, <<"/images/icon.png">> } ], [] }
  +        ]},
  +        mochiweb_html:parse(D0)),     
  +        
  +    D1 = <<"<html><img src=\"/images/icon.png'></html>">>,
  +    ?assertEqual(
  +        {<<"html">>,[],[
  +            { <<"img">>, [ { <<"src">>, <<"/images/icon.png'></html>">> } ], [] }
  +        ]},
  +        mochiweb_html:parse(D1)),     
  +
  +    D2 = <<"<html><img src=\"/images/icon&gt;.png\"></html>">>,
  +    ?assertEqual(
  +        {<<"html">>,[],[
  +            { <<"img">>, [ { <<"src">>, <<"/images/icon>.png">> } ], [] }
  +        ]},
  +        mochiweb_html:parse(D2)),     
  +    ok.
  +
  +parse_missing_attr_name_test() ->
  +    D0 = <<"<html =black></html>">>,
  +    ?assertEqual(
  +        {<<"html">>, [ { <<"=">>, <<"=">> }, { <<"black">>, <<"black">> } ], [] },
  +       mochiweb_html:parse(D0)),
  +    ok.
  +
  +parse_broken_pi_test() ->
  +	D0 = <<"<html><?xml:namespace prefix = o ns = \"urn:schemas-microsoft-com:office:office\" /></html>">>,
  +	?assertEqual(
  +		{<<"html">>, [], [
  +			{ pi, <<"xml:namespace">>, [ { <<"prefix">>, <<"o">> }, 
  +			                             { <<"ns">>, <<"urn:schemas-microsoft-com:office:office">> } ] }
  +		] },
  +		mochiweb_html:parse(D0)),
  +	ok.
  +
  +parse_funny_singletons_test() ->
  +	D0 = <<"<html><input><input>x</input></input></html>">>,
  +	?assertEqual(
  +		{<<"html">>, [], [
  +			{ <<"input">>, [], [] },
  +			{ <<"input">>, [], [ <<"x">> ] }
  +		] },
  +		mochiweb_html:parse(D0)),
  +	ok.
  +    
   -endif.
  
positive.code: %%
  %% Tests
  %%
  -include_lib("eunit/include/eunit.hrl").
  -ifdef(TEST).
  
  to_html_test() ->
      ?assertEqual(
  
negative.code:                            {<<"br">>, [], []},
                             <<"bar">>]}]},
         parse(<<"<html><link>foo<br>bar</link></html>">>)),
      %% Case insensitive tags
      ?assertEqual(
         {<<"html">>, [],
          [{<<"head">>, [], [<<"foo">>,
                             {<<"br">>, [], []},
                             <<"BAR">>]},
           {<<"body">>, [{<<"class">>, <<"">>}, {<<"bgcolor">>, <<"#Aa01fF">>}], []}
          ]},
         parse(<<"<html><Head>foo<bR>BAR</head><body Class=\"\" bgcolor=\"#Aa01fF\"></BODY></html>">>)),
      ok.
  
  exhaustive_is_singleton_test() ->
  