require 'amrita2'
require 'amrita2/testsupport'
context "normalize xml"do
include Amrita2::TestSupport
specify "single tag" do
normalize("").should == '
'
normalize("").should == ''
end
specify "single tag with attributes" do
normalize("").should == ''
normalize("").should == ''
end
specify "tag with text" do
normalize("xx").should == "\nxx\n"
end
specify "nested tag" do
normalize("
").should == "\n
\n"
end
specify "nested tag with text" do
normalize("<_>xx").should == "\n<_>\nxx\n\n"
end
specify "text" do
normalize("abc").should == "abc"
normalize(" abc ").should == "abc"
normalize(" \n abc \n ").should == "abc"
normalize(" \n abc \n abc").should == "abc abc"
normalize(" \n a b c \n a b c\n").should == "a b c a b c"
normalize(" \n a b c \n a b c\n\n").should == "\na b c a b c\n"
end
specify "single tag with space" do
normalize('<_ am:src="title" />').should == '<_ am:src="title" />'
normalize(" <_ am:src='title' /> \n").should == '<_ am:src="title">'
end
end
context "should_same_xml_as" do
specify "xml" do
a = "