Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 29 lines (24 sloc) 0.931 kB
34d5725 @nrk Imported the test suite of Hpricot 0.8.1 in the repository.
authored
1 #!/usr/bin/env ruby
2
3 require 'test/unit'
4 require 'hpricot'
5 require 'load_files'
6
7 class TestParser < Test::Unit::TestCase
8 # normally, the link tags are empty HTML tags.
9 # contributed by laudney.
10 def test_normally_empty
11 doc = Hpricot::XML("<rss><channel><title>this is title</title><link>http://fake.com</link></channel></rss>")
12 assert_equal "this is title", (doc/:rss/:channel/:title).text
13 assert_equal "http://fake.com", (doc/:rss/:channel/:link).text
14 end
15
16 # make sure XML doesn't get downcased
17 def test_casing
18 doc = Hpricot::XML(TestFiles::WHY)
19 assert_equal "hourly", (doc.at "sy:updatePeriod").inner_html
20 assert_equal 1, (doc/"guid[@isPermaLink]").length
21 end
22
23 # be sure tags named "text" are ok
24 def test_text_tags
25 doc = Hpricot::XML("<feed><title>City Poisoned</title><text>Rita Lee has poisoned Brazil.</text></feed>")
26 assert_equal "City Poisoned", (doc/"title").text
27 end
28 end
Something went wrong with that request. Please try again.