require 'test/unit' require "openid/yadis/parsehtml" require "testutil" module OpenID class ParseHTMLTestCase < Test::Unit::TestCase include OpenID::TestDataMixin def test_parsehtml reserved_values = ['None', 'EOF'] chunks = read_data_file('test1-parsehtml.txt', false).split("\f\n") test_num = 1 chunks.each{|c| expected, html = c.split("\n", 2) found = Yadis::html_yadis_location(html) assert(!reserved_values.member?(found)) # this case is a little hard to detect and the distinction # seems unimportant expected = "None" if expected == "EOF" found = "None" if found.nil? assert_equal(expected, found, html.split("\n",2)[0]) } end end # the HTML tokenizer test class TC_TestHTMLTokenizer < Test::Unit::TestCase def test_bad_link toke = HTMLTokenizer.new("
") assert("http://bad.com/link" == toke.getTag("a").attr_hash['href']) end def test_namespace toke = HTMLTokenizer.new("This is the paragraph, it contains links, . Ok, here is some more text and another link.
" toke = HTMLTokenizer.new(page) assert("