xpWrap )
import TSN.DbImport ( ImportResult(..) )
-import Xml ( pickle_unpickle )
+import Xml ( pickle_unpickle, unpickleable )
data Message =
Message {
heartbeat_tests =
testGroup
"Heartbeat 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/Heartbeat.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/Heartbeat.xml"
+ actual <- unpickleable path pickle_message
+ let expected = True
+ actual @?= expected
import TSN.DbImport ( DbImport(..), import_generic )
-import Xml ( pickle_unpickle )
+import Xml ( pickle_unpickle, unpickleable )
data Listing =
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
import TSN.DbImport ( DbImport(..), import_generic )
import TSN.Picklers( xp_date, xp_team_id )
-import Xml ( pickle_unpickle )
+import Xml ( pickle_unpickle, unpickleable )
data PlayerListing =
injuries_detail_tests =
testGroup
"InjuriesDetail 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/Injuries_Detail_XML.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/Injuries_Detail_XML.xml"
+ actual <- unpickleable path pickle_message
+ let expected = True
+ actual @?= expected
tsn_codegen_config,
tsn_db_field_namer ) -- Used in a test
import TSN.DbImport ( DbImport(..), ImportResult(..) )
-import Xml ( ToFromXml(..), pickle_unpickle )
+import Xml ( ToFromXml(..), pickle_unpickle, unpickleable )
testGroup
"News tests"
[ test_news_fields_have_correct_names,
- test_pickle_of_unpickle_is_identity ]
-
-
-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/newsxml.xml"
- (expected :: [MessageXml], actual) <- pickle_unpickle "message" path
- actual @?= expected
+ test_pickle_of_unpickle_is_identity,
+ test_unpickle_succeeds ]
test_news_fields_have_correct_names :: TestTree
actual = ["mid", "sport", "url", "sms", "text", "continue"]
check (x,y) = (x @?= y)
+
+
+-- | 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/newsxml.xml"
+ (expected :: [MessageXml], actual) <- pickle_unpickle "message" path
+ actual @?= expected
+
+
+test_unpickle_succeeds :: TestTree
+test_unpickle_succeeds =
+ testCase "unpickling succeeds" $ do
+ let path = "test/xml/newsxml.xml"
+ actual <- unpickleable path pickle_message
+ let expected = True
+ actual @?= expected