xp4Tuple,
xp6Tuple,
xpElem,
+ xpInt,
xpList,
xpPrim,
xpText,
import TSN.DbImport ( DbImport(..), import_generic )
-import Xml ( pickle_unpickle )
+import Xml ( pickle_unpickle, unpickleable )
data Listing =
xpElem "listing" $
xpWrap (from_tuple, to_tuple) $
xp4Tuple (xpElem "team" xpText)
- (xpElem "teamno" xpPrim)
+ (xpElem "teamno" xpInt)
(xpElem "injuries" xpText)
(xpElem "updated" xpPrim)
where
pickle_message =
xpElem "message" $
xpWrap (from_tuple, to_tuple) $
- xp6Tuple (xpElem "XML_File_ID" xpPrim)
+ xp6Tuple (xpElem "XML_File_ID" xpInt)
(xpElem "heading" xpText)
(xpElem "category" xpText)
(xpElem "sport" xpText)
injuries_tests =
testGroup
"Injuries tests"
- [ test_pickle_of_unpickle_is_identity ]
+ [ test_pickle_of_unpickle_is_identity,
+ test_unpickle_succeeds ]
+-- | Warning, succeess of this test does not mean that unpickling
+-- succeeded.
test_pickle_of_unpickle_is_identity :: TestTree
test_pickle_of_unpickle_is_identity =
testCase "pickle composed with unpickle is the identity" $ do
let path = "test/xml/injuriesxml.xml"
(expected :: [Message], actual) <- pickle_unpickle "message" path
actual @?= expected
+
+
+test_unpickle_succeeds :: TestTree
+test_unpickle_succeeds =
+ testCase "unpickling succeeds" $ do
+ let path = "test/xml/injuriesxml.xml"
+ actual <- unpickleable path pickle_message
+ let expected = True
+ actual @?= expected