+
+
+test_types_detected_correctly :: TestTree
+test_types_detected_correctly =
+ testGroup "weatherxml types detected correctly" $
+ [ check "test/xml/weatherxml.xml"
+ "first type detected correctly"
+ True,
+ check "test/xml/weatherxml-detailed.xml"
+ "first type detected correctly (detailed)"
+ True,
+ check "test/xml/weatherxml-type2.xml"
+ "second type detected correctly"
+ False ]
+ where
+ unsafe_get_xmltree :: String -> IO XmlTree
+ unsafe_get_xmltree path =
+ fmap head $ runX $ readDocument parse_opts path
+
+ check path desc expected = testCase desc $ do
+ xmltree <- unsafe_get_xmltree path
+ let actual = is_type1 xmltree
+ actual @?= expected