Permalink
Browse files

Fix incorrect closing CDATA delimiter. Add tests for CDATA nodes.

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent d1922cc commit 8fad8d7e174cf4f1a5bb529f24f88028fbef39f5 @packagethief packagethief committed with jeremy Oct 22, 2008
@@ -272,7 +272,7 @@ def ==(node)
# itself.
class CDATA < Text #:nodoc:
def to_s
- "<![CDATA[#{super}]>"
+ "<![CDATA[#{super}]]>"
end
end
@@ -0,0 +1,15 @@
+require 'abstract_unit'
+
+class CDATANodeTest < Test::Unit::TestCase
+ def setup
+ @node = HTML::CDATA.new(nil, 0, 0, "<p>howdy</p>")
+ end
+
+ def test_to_s
+ assert_equal "<![CDATA[<p>howdy</p>]]>", @node.to_s
+ end
+
+ def test_content
+ assert_equal "<p>howdy</p>", @node.content
+ end
+end

0 comments on commit 8fad8d7

Please sign in to comment.