require "test/unit" require "nitro/html" include N class TC_HtmlUtils < Test::Unit::TestCase # :nodoc: all def test_escape assert_equal("<b>test</b>", HtmlUtils::escape("test")) assert_equal("<p>test", HtmlUtils::escape("
test")) assert_equal("", HtmlUtils::escape("")) assert_equal(nil, HtmlUtils::escape(nil)) end def test_expand_urls s = "visit http://www.navel.gr" r = "visit http://www.navel.gr" assert_equal(r, HtmlUtils::expand_urls(s)) s = "visit www.navel.gr" r = "visit http://www.navel.gr" assert_equal(r, HtmlUtils::expand_urls(s)) assert_equal(nil, HtmlUtils::expand_urls(nil)) s = "visit: www.navel.gr" r = "visit: http://www.navel.gr" assert_equal(r, HtmlUtils::expand_urls(s)) end def test_only_safe_tags s = "