X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FInjuriesDetail.hs;h=38e0268a4e1d518cf6d00c1d0fed2d8f8c8661d0;hb=d476419274cdf2997d768444cecc47922a902fdf;hp=c06768ed554c2f9aa399afd948f23838f79ace62;hpb=2f0d419104ac1ad108ae1b29d6722ed032286665;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/InjuriesDetail.hs b/src/TSN/XML/InjuriesDetail.hs index c06768e..38e0268 100644 --- a/src/TSN/XML/InjuriesDetail.hs +++ b/src/TSN/XML/InjuriesDetail.hs @@ -17,8 +17,11 @@ -- are not retained. -- module TSN.XML.InjuriesDetail ( + pickle_message, + -- * Tests injuries_detail_tests, - pickle_message ) + -- * WARNING: these are private but exported to silence warnings + PlayerListingConstructor(..) ) where import Data.Time ( UTCTime ) @@ -39,9 +42,9 @@ import Text.XML.HXT.Core ( xpElem, xpInt, xpList, + xpOption, xpPrim, xpText, - xpText0, xpWrap ) import TSN.Picklers( xp_date, xp_team_id ) @@ -60,7 +63,7 @@ data PlayerListing = name :: String, injury :: String, status :: String, - fantasy :: String, -- ^ Nobody knows what this is. + fantasy :: Maybe String, -- ^ Nobody knows what this is. injured :: Bool, injury_type :: String -- ^ "type" is a reserved keyword so we can't use it } @@ -121,7 +124,7 @@ pickle_player_listing = (xpElem "Name" xpText) (xpElem "Injury" xpText) (xpElem "Status" xpText) - (xpElem "Fantasy" xpText0) + (xpElem "Fantasy" $ xpOption xpText) (xpElem "Injured" xpPrim) (xpElem "Type" xpText) where @@ -169,8 +172,12 @@ pickle_message = listings m, time_stamp m) +-- +-- Tasty Tests +-- --- * Tasty Tests +-- | A list of all tests for this module. +-- injuries_detail_tests :: TestTree injuries_detail_tests = testGroup @@ -179,8 +186,10 @@ injuries_detail_tests = test_unpickle_succeeds ] --- | Warning, succeess of this test does not mean that unpickling --- succeeded. +-- | If we unpickle something and then pickle it, we should wind up +-- with the same thing we started with. WARNING: succeess of this +-- test does not mean that unpickling succeeded. +-- test_pickle_of_unpickle_is_identity :: TestTree test_pickle_of_unpickle_is_identity = testGroup "pickle-unpickle tests" [ check "pickle composed with unpickle is the identity" @@ -194,6 +203,8 @@ test_pickle_of_unpickle_is_identity = testGroup "pickle-unpickle tests" actual @?= expected +-- | Make sure we can actually unpickle these things. +-- test_unpickle_succeeds :: TestTree test_unpickle_succeeds = testGroup "unpickle tests" [ check "unpickling succeeds"