Skip to content

Commit

Permalink
adjust unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wfeldt committed Feb 17, 2022
1 parent 564f234 commit 3d7eb0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/xml/test/xml_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@
expect(subject.YCPToXMLString("test", input)).to eq expected
end

it "creates no CDATA element if string starts with spaces" do
it "creates CDATA element if string starts with spaces" do
input = { "test" => " test", "lest" => "\nlest" }
expected = "<?xml version=\"1.0\"?>\n" \
"<!DOCTYPE test SYSTEM \"just_testing.dtd\">\n" \
"<test>\n" \
" <lest>\nlest</lest>\n" \
" <test> test</test>\n" \
" <lest><![CDATA[\nlest]]></lest>\n" \
" <test><![CDATA[ test]]></test>\n" \
"</test>\n"

expect(subject.YCPToXMLString("test", input)).to eq expected
Expand Down Expand Up @@ -343,13 +343,13 @@
expect(subject.XMLToYCPString(input)).to eq expected
end

it "strips spaces at the start of CDATA elements" do
it "preserves spaces at the start of CDATA elements" do
input = "<?xml version=\"1.0\"?>\n" \
"<test xmlns=\"http://www.suse.com/1.0/yast2ns\" xmlns:config=\"http://www.suse.com/1.0/configns\">\n" \
" <test><![CDATA[ foo]]></test>\n" \
" <lest><![CDATA[\nbar]]></lest>\n" \
"</test>\n"
expected = { "test" => "foo", "lest" => "bar" }
expected = { "test" => " foo", "lest" => "\nbar" }

expect(subject.XMLToYCPString(input)).to eq expected
end
Expand Down

0 comments on commit 3d7eb0d

Please sign in to comment.