X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FSportInfo.hs;h=bfac8527605d988a68ad0ccedc035e92e6c3c3d4;hb=b45f24209ce6f1eb3c24a5f01a71f5940a001c02;hp=99a5705c54c5d331a4269238f18301c643871d0d;hpb=631c83d02fda46726b8712ff345dbdbac26eebfc;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/SportInfo.hs b/src/TSN/XML/SportInfo.hs index 99a5705..bfac852 100644 --- a/src/TSN/XML/SportInfo.hs +++ b/src/TSN/XML/SportInfo.hs @@ -18,7 +18,7 @@ module TSN.XML.SportInfo ( dtds, parse_xml, - sportinfo_tests, + sport_info_tests, -- * WARNING: these are private but exported to silence warnings SportInfoConstructor(..) ) where @@ -58,7 +58,7 @@ import Xml ( unsafe_read_document ) --- | The DTDs for everything that we consider "Sport Info." +-- | The DTDs for everything that we consider \"Sport Info.\" -- -- TODO: This is the list from the old implementation. We need to -- make sure that we are really receiving XML for these DTDs @@ -67,18 +67,16 @@ import Xml ( dtds :: [String] dtds = [ "CBASK_3PPctXML.dtd", - "Cbask_All_Tourn_Teams_XML.dtd", -- no dtd - "CBASK_AssistsXML.dtd", -- no dtd - "Cbask_Awards_XML.dtd", -- no dtd - "CBASK_BlocksXML.dtd", -- no dtd - "CBask_BlocksXML.dtd", -- no dtd - "Cbask_Conf_Standings_XML.dtd", -- no dtd - "Cbask_DivII_III_Indv_Stats_XML.dtd", -- no dtd - "Cbask_DivII_Team_Stats_XML.dtd", -- no dtd - "Cbask_DivIII_Team_Stats_XML.dtd", -- no dtd - "CBASK_FGPctXML.dtd", -- no dtd - "CBask_FGPctXML.dtd", -- no dtd - "CBASK_FoulsXML.dtd", -- no dtd + "Cbask_All_Tourn_Teams_XML.dtd", + "CBASK_AssistsXML.dtd", + "Cbask_Awards_XML.dtd", + "CBASK_BlocksXML.dtd", + "Cbask_Conf_Standings_XML.dtd", + "Cbask_DivII_III_Indv_Stats_XML.dtd", + "Cbask_DivII_Team_Stats_XML.dtd", + "Cbask_DivIII_Team_Stats_XML.dtd", + "CBASK_FGPctXML.dtd", + "CBASK_FoulsXML.dtd", "CBASK_FTPctXML.dtd", -- no dtd "Cbask_Indv_No_Avg_XML.dtd", -- no dtd "Cbask_Indv_Scoring_XML.dtd", -- no dtd @@ -306,8 +304,8 @@ mkPersist tsn_codegen_config [groundhog| -- | A list of all tests for this module. -- -sportinfo_tests :: TestTree -sportinfo_tests = +sport_info_tests :: TestTree +sport_info_tests = testGroup "SportInfo tests" [ test_parse_xml_succeeds, @@ -316,17 +314,28 @@ sportinfo_tests = -- | Sample XML documents for SportInfo types. -- -sportinfo_test_files :: [FilePath] -sportinfo_test_files = - [ "test/xml/sportinfo/CBASK_3PPctXML.xml" ] +sport_info_test_files :: [FilePath] +sport_info_test_files = + [ "test/xml/sportinfo/CBASK_3PPctXML.xml", + "test/xml/sportinfo/Cbask_All_Tourn_Teams_XML.xml", + "test/xml/sportinfo/CBASK_AssistsXML.xml", + "test/xml/sportinfo/Cbask_Awards_XML.xml", + "test/xml/sportinfo/CBASK_BlocksXML.xml", + "test/xml/sportinfo/Cbask_Conf_Standings_XML.xml", + "test/xml/sportinfo/Cbask_DivII_III_Indv_Stats_XML.xml", + "test/xml/sportinfo/Cbask_DivII_Team_Stats_XML.xml", + "test/xml/sportinfo/Cbask_DivIII_Team_Stats_XML.xml", + "test/xml/sportinfo/CBASK_FGPctXML.xml", + "test/xml/sportinfo/CBASK_FoulsXML.xml" + ] --- | Make sure we can parse every element of 'sportinfo_test_files'. +-- | Make sure we can parse every element of 'sport_info_test_files'. -- test_parse_xml_succeeds :: TestTree test_parse_xml_succeeds = - testGroup "parse_xml" $ map check sportinfo_test_files + testGroup "parse_xml" $ map check sport_info_test_files where check t = testCase t $ do x <- unsafe_read_document t @@ -338,14 +347,14 @@ test_parse_xml_succeeds = actual @?= expected --- | Ensure that each element of 'sportinfo_test_files' can be imported +-- | Ensure that each element of 'sport_info_test_files' can be imported -- by counting the total number of database records (after -- importing) and comparing it against the length of --- 'sportinfo_test_files'. +-- 'sport_info_test_files'. -- test_dbimport_succeeds :: TestTree test_dbimport_succeeds = testCase "dbimport succeeds" $ do - xmltrees <- mapM unsafe_read_document sportinfo_test_files + xmltrees <- mapM unsafe_read_document sport_info_test_files let msgs = rights $ map (parse_xml "dummy") xmltrees actual <- withSqliteConn ":memory:" $ runDbConn $ do runMigration silentMigrationLogger $ do @@ -355,4 +364,4 @@ test_dbimport_succeeds = testCase "dbimport succeeds" $ do actual @?= expected where - expected = length sportinfo_test_files + expected = length sport_info_test_files