HTF 0.14.0.5 → 0.14.0.6
raw patch · 2 files changed
+37/−29 lines, 2 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- HTF.cabal +15/−7
- Test/Framework/History.hs +22/−22
HTF.cabal view
@@ -1,5 +1,5 @@ Name: HTF-Version: 0.14.0.5+Version: 0.14.0.6 License: LGPL-2.1 License-File: LICENSE Copyright: (c) 2005-2015 Stefan Wehr@@ -84,12 +84,20 @@ scripts/run-sample scripts/prepare +tested-with:+ GHC == 8.2.2+ GHC == 8.4.4+ GHC == 8.6.5+ GHC == 8.8.4+ GHC == 8.10.4+ GHC == 9.0.1+ Source-Repository head Type: git Location: http://github.com/skogsbaer/HTF.git Custom-Setup- Setup-Depends: base == 4.*,+ Setup-Depends: base >= 4.10 && < 5, process, Cabal @@ -97,7 +105,7 @@ Main-Is: HTFPP.hs Build-Depends: HUnit, array,- base == 4.*,+ base >= 4.10 && < 5, cpphs >= 1.19, directory >= 1.0, mtl >= 1.1,@@ -120,7 +128,7 @@ QuickCheck >= 2.3, aeson >= 0.11, array,- base == 4.*,+ base >= 4.10 && < 5, base64-bytestring, bytestring >= 0.9, containers >= 0.5,@@ -179,7 +187,7 @@ Hs-Source-Dirs: tests Build-depends: HTF, HUnit,- base == 4.*,+ base >= 4.10 && < 5, mtl, random Build-tool-depends: HTF:htfpp@@ -192,7 +200,7 @@ Build-depends: HTF, aeson >= 0.6, aeson-pretty,- base == 4.*,+ base >= 4.10 && < 5, bytestring >= 0.9, directory >= 1.0, filepath >= 1.1,@@ -215,7 +223,7 @@ Type: exitcode-stdio-1.0 Hs-Source-Dirs: tests Build-depends: HTF,- base == 4.*,+ base >= 4.10 && < 5, mtl, random Build-tool-depends: HTF:htfpp
Test/Framework/History.hs view
@@ -103,6 +103,28 @@ _CURRENT_VERSION_ :: Int _CURRENT_VERSION_ = 0 +instance ToJSON TestResult where+ toJSON r = String $+ case L.lookup r testResultStringMapping of+ Just s -> s+ Nothing -> error ("TestResult " ++ show r ++ " not defined in testResultStringMapping")++instance FromJSON TestResult where+ parseJSON v =+ case v of+ String s+ | Just r <- L.lookup s (map (\(x, y) -> (y, x)) testResultStringMapping)+ -> return r+ _ -> fail ("could not parse JSON value as a test result: " ++ show v)++testResultStringMapping :: [(TestResult, T.Text)]+testResultStringMapping =+ [(Pass, "pass"), (Pending, "pending"), (Fail, "fail"), (Error, "error")]++deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''HistoricTestResult+deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''TestRunHistory+deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''SerializableTestHistory+ serializeTestHistory :: TestHistory -> BS.ByteString serializeTestHistory hist = let serHist = SerializableTestHistory {@@ -139,25 +161,3 @@ mkRes id ms = HistoricTestResult id Pass False ms historyTests = [("testCreateIndex", testCreateIndex)]--testResultStringMapping :: [(TestResult, T.Text)]-testResultStringMapping =- [(Pass, "pass"), (Pending, "pending"), (Fail, "fail"), (Error, "error")]--instance ToJSON TestResult where- toJSON r = String $- case L.lookup r testResultStringMapping of- Just s -> s- Nothing -> error ("TestResult " ++ show r ++ " not defined in testResultStringMapping")--instance FromJSON TestResult where- parseJSON v =- case v of- String s- | Just r <- L.lookup s (map (\(x, y) -> (y, x)) testResultStringMapping)- -> return r- _ -> fail ("could not parse JSON value as a test result: " ++ show v)--deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''SerializableTestHistory-deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''TestRunHistory-deriveJSON (defaultOptions { fieldLabelModifier = drop 4 }) ''HistoricTestResult