xml_url :: Maybe String,
xml_teams :: [NewsTeam],
xml_locations :: [Location],
- xml_sms :: String,
+ xml_sms :: Maybe String,
xml_editor :: Maybe String,
xml_text :: Maybe String, -- Text and continue seem to show up in pairs,
xml_continue :: Maybe String, -- either both present or both missing.
db_mid :: MsgId,
db_sport :: String,
db_url :: Maybe String,
- db_sms :: String,
+ db_sms :: Maybe String,
db_editor :: Maybe String,
db_text :: Maybe String,
db_continue :: Maybe String,
(xpElem "url" $ xpOption xpText)
(xpList pickle_news_team)
(xpList pickle_location)
- (xpElem "SMS" xpText)
+ (xpElem "SMS" $ xpOption xpText)
(xpOption (xpElem "Editor" xpText))
(xpOption (xpElem "text" xpText))
pickle_continue
"test/xml/newsxml.xml",
check "pickle composed with unpickle is the identity (with Editor)"
- "test/xml/newsxml-with-editor.xml" ]
+ "test/xml/newsxml-with-editor.xml",
+
+ check "pickle composed with unpickle is the identity (empty SMS)"
+ "test/xml/newsxml-empty-sms.xml" ]
where
check desc path = testCase desc $ do
(expected, actual) <- pickle_unpickle pickle_message path
"test/xml/newsxml.xml",
check "unpickling succeeds (with Editor)"
- "test/xml/newsxml-with-editor.xml" ]
+ "test/xml/newsxml-with-editor.xml",
+
+ check "unpickling succeeds (empty SMS)"
+ "test/xml/newsxml-empty-sms.xml" ]
where
check desc path = testCase desc $ do
actual <- unpickleable path pickle_message
[ check "deleting news deletes its children"
"test/xml/newsxml.xml"
4 -- 2 news_teams and 2 news_locations that should remain.
+ ,
+ check "deleting news deletes its children (empty SMS)"
+ "test/xml/newsxml-empty-sms.xml"
+ 4 -- 2 news_teams and 2 news_locations
]
where
check desc path expected = testCase desc $ do