test/xml_test.rb in iq_rdf-0.1.5 vs test/xml_test.rb in iq_rdf-0.1.6
- old
+ new
@@ -26,19 +26,16 @@
t.Foaf::knows(IqRdf::testefrau)
t.Foaf.nick("Testy")
t.Foaf.lastname("Testemann", :lang => :none)
end
- assert_equal(<<rdf, document.to_xml)
-<?xml version="1.0" encoding="UTF-8"?>
-<rdf:RDF xmlns="http://www.test.de/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xml:lang="de">
+ assert_match(<<rdf, document.to_xml)
<rdf:Description rdf:about="http://www.test.de/testemann">
<foaf:knows rdf:resource="http://www.test.de/testefrau"/>
<foaf:nick>Testy</foaf:nick>
<foaf:lastname xml:lang="">Testemann</foaf:lastname>
</rdf:Description>
-</rdf:RDF>
rdf
end
def test_full_uri_subject_xml_output
document = IqRdf::Document.new('http://www.test.de/')
@@ -49,18 +46,15 @@
document << IqRdf::build_full_uri_subject(URI.parse('http://www.xyz.de/#test'), IqRdf::build_uri('SomeType')) do |t|
t.sometest("testvalue")
end
- assert_equal(<<rdf, document.to_xml)
-<?xml version="1.0" encoding="UTF-8"?>
-<rdf:RDF xmlns="http://www.test.de/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
+ assert_match(<<rdf, document.to_xml)
<rdf:Description rdf:about="http://www.xyz.de/#test">
<rdf:type rdf:resource="http://www.test.de/SomeType"/>
<sometest>testvalue</sometest>
</rdf:Description>
-</rdf:RDF>
rdf
end
def test_complex_features
document = IqRdf::Document.new('http://www.umweltprobenbank.de/', :lang => :de)
@@ -91,13 +85,11 @@
blank_node.sub do |subnode| # sub [
subnode.title("blubb") # title "blubb"
end # ]
end # ]
- assert_equal(<<rdf, document.to_xml)
-<?xml version="1.0" encoding="UTF-8"?>
-<rdf:RDF xmlns="http://www.umweltprobenbank.de/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:skos="http://www.w3.org/2008/05/skos#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:upb="http://www.upb.de/" xml:lang="de">
+ assert_match(<<rdf, document.to_xml)
<rdf:Description rdf:about="http://www.umweltprobenbank.de/testemann">
<myCustomNote xml:lang="en">This is an example</myCustomNote>
</rdf:Description>
<rdf:Description rdf:about="http://www.umweltprobenbank.de/testemann">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
@@ -152,11 +144,10 @@
</rdf:Description>
</sub>
</rdf:Description>
</test32>
</rdf:Description>
-</rdf:RDF>
rdf
=begin
skos:testnode :test32 [
:title "dies ist ein test"@de;
@@ -176,35 +167,32 @@
t.Foaf.nick("Testy")
t.Foaf.lastname("Testemann", :lang => :none)
t.age(32)
t.married(false)
t.weight(65.8)
- t.complex(IqRdf::Literal.new("A very complex type", :none, URI.parse("http://this.com/is#complex")))
- t.complex2(IqRdf::Literal.new("Shorter form", :none, IqRdf::myDatatype))
+ t.complex(IqRdf::Literal.new("A very complex type", nil, URI.parse("http://this.com/is#complex")))
+ t.complex2(IqRdf::Literal.new("Shorter form", nil, IqRdf::myDatatype))
t.quotes("\"I'm \\quoted\"")
t.line_breaks("I'm written\nover two lines")
t.some_literal(IqRdf::Literal.new("text", :de))
end
- assert_equal(<<rdf, document.to_xml)
-<?xml version="1.0" encoding="UTF-8"?>
-<rdf:RDF xmlns="http://www.test.de/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xml:lang="de">
+ assert_match(<<rdf, document.to_xml)
<rdf:Description rdf:about="http://www.test.de/testemann">
<foaf:knows rdf:resource="http://www.test.de/testefrau"/>
<foaf:nick>Testy</foaf:nick>
<foaf:lastname xml:lang="">Testemann</foaf:lastname>
<age rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">32</age>
<married rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</married>
<weight rdf:datatype="http://www.w3.org/2001/XMLSchema#decimal">65.8</weight>
- <complex rdf:datatype="http://this.com/is#complex" xml:lang="none">A very complex type</complex>
- <complex2 rdf:datatype="http://www.test.de/myDatatype" xml:lang="none">Shorter form</complex2>
+ <complex rdf:datatype="http://this.com/is#complex">A very complex type</complex>
+ <complex2 rdf:datatype="http://www.test.de/myDatatype">Shorter form</complex2>
<quotes>"I'm \\quoted"</quotes>
<line_breaks>I'm written
over two lines</line_breaks>
<some_literal xml:lang="de">text</some_literal>
</rdf:Description>
-</rdf:RDF>
rdf
end
def test_blank_nodes
document = IqRdf::Document.new('http://www.test.de/')
@@ -214,13 +202,11 @@
blank_node.build_predicate(:test, "Another test") # :test "Another test";
blank_node.sub do |subnode| # sub [
subnode.title("blubb") # title "blubb"
end # ]
end # ]
- assert_equal(<<rdf, document.to_xml)
-<?xml version=\"1.0\" encoding=\"UTF-8\"?>
-<rdf:RDF xmlns=\"http://www.test.de/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">
+ assert_match(<<rdf, document.to_xml)
<rdf:Description rdf:about=\"http://www.test.de/testnode\">
<test32>
<rdf:Description>
<title>dies ist ein test</title>
<test>Another test</test>
@@ -230,10 +216,9 @@
</rdf:Description>
</sub>
</rdf:Description>
</test32>
</rdf:Description>
-</rdf:RDF>
rdf
end
end