require "test/unit" require "atom/entry" class ConstructTest < Test::Unit::TestCase def test_text_construct_text entry = Atom::Entry.new assert_nil(entry.title) assert_equal("", entry.title.to_s) entry.title = "<3" assert_equal "text", entry.title["type"] assert_equal "<3", entry.title.to_s assert_equal "<3", entry.title.html assert_equal "'<3'#text", entry.title.inspect title = entry.to_xml.root.children.first assert_equal "<3", title.text end def test_text_construct_html entry = Atom::Entry.new =begin entry.title = "<3" entry.title["type"] = "html" assert_equal "html", entry.title["type"] assert_equal "<3", entry.title.to_s assert_equal "<3", entry.title.html title = entry.to_xml.root.children.first assert_equal "<3", title.text =end entry.title = "
pi < 4?" entry.title["type"] = "html" assert_equal "
pi < 4?", entry.title.to_s assert_equal "
pi < 4?", entry.title.html end def test_text_construct_xhtml entry = Atom::Entry.new entry.title = "<3" assert_raises(RuntimeError) { entry.title["type"] = "xhtml" } assert_raises(RuntimeError) do entry.title["type"] = "application/xhtml+xml" end entry.title = REXML::Document.new("