Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added simple singleton node parsing tests.

Ignore-this: dd01bd66fe8060bd6b42355cfd84295e

darcs-hash:20110129215828-1786f-44fe3c6c4338c487642fb1489aa160f4ba358ff7.gz
  • Loading branch information...
commit b5cc2c3d0e3aec805a1448e07bf3d90cd9a17efc 1 parent 0fca403
Alex McCausland authored
Showing with 30 additions and 2 deletions.
  1. +30 −2 testsuite/tests/Text/RDF/RDF4H/XmlParser_Test.hs
32 testsuite/tests/Text/RDF/RDF4H/XmlParser_Test.hs
View
@@ -26,7 +26,9 @@ import Data.RDF.TriplesGraph_Test
import Text.RDF.RDF4H.XmlParser
-tests = [ testGroup "XmlParser:parseXmlRDF" [ testCase "simpleStriping" test_simpleStriping
+tests = [ testGroup "XmlParser:parseXmlRDF" [ testCase "simpleStriping1" test_simpleStriping1
+ , testCase "simpleSingleton1" test_simpleSingleton1
+ , testCase "simpleSingleton2" test_simpleSingleton2
, testCase "example07" test_parseXmlRDF_example07
-- , testCase "example08" test_parseXmlRDF_example08
-- , testCase "example09" test_parseXmlRDF_example09
@@ -49,7 +51,7 @@ mkTextNode = lnode . plainL . s2b
testParse exRDF ex = assertBool ("expected: " ++ show ex ++ "but got: " ++ show parsed) (isIsomorphic (parsed :: TriplesGraph) (ex :: TriplesGraph))
where parsed = case parseXmlRDF Nothing Nothing (s2b exRDF) of Right result -> result
-test_simpleStriping = testParse
+test_simpleStriping1 = testParse
"<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\
\<rdf:Description rdf:about=\"http://www.w3.org/TR/rdf-syntax-grammar\">\
@@ -62,6 +64,32 @@ test_simpleStriping = testParse
, (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
)
+test_simpleSingleton1 = testParse
+ "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
+ \ xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\
+ \<rdf:Description rdf:about=\"http://www.w3.org/TR/rdf-syntax-grammar\"\
+ \ dc:title=\"RDF/XML Syntax Specification (Revised)\"/>\
+ \</rdf:RDF>"
+ ( mkRdf [ Triple ((unode . s2b) "http://www.w3.org/TR/rdf-syntax-grammar") ((unode . s2b) "dc:title") (mkTextNode "RDF/XML Syntax Specification (Revised)") ]
+ Nothing
+ ( PrefixMappings (Map.fromList [ (s2b "dc", s2b "http://purl.org/dc/elements/1.1/")
+ , (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
+ )
+
+test_simpleSingleton2 = testParse
+ "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
+ \ xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\
+ \<rdf:Description rdf:about=\"http://www.w3.org/TR/rdf-syntax-grammar\"\
+ \ dc:title=\"RDF/XML Syntax Specification (Revised)\"\
+ \ dc:subject=\"RDF\"/>\
+ \</rdf:RDF>"
+ ( mkRdf [ Triple ((unode . s2b) "http://www.w3.org/TR/rdf-syntax-grammar") ((unode . s2b) "dc:title") (mkTextNode "RDF/XML Syntax Specification (Revised)")
+ , Triple ((unode . s2b) "http://www.w3.org/TR/rdf-syntax-grammar") ((unode . s2b) "dc:subject") (mkTextNode "RDF") ]
+ Nothing
+ ( PrefixMappings (Map.fromList [ (s2b "dc", s2b "http://purl.org/dc/elements/1.1/")
+ , (s2b "rdf", s2b "http://www.w3.org/1999/02/22-rdf-syntax-ns#") ]) )
+ )
+
example07 = "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\
\ xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\
\ xmlns:ex=\"http://example.org/stuff/1.0/\">\
Please sign in to comment.
Something went wrong with that request. Please try again.