1
1
mirror of https://github.com/github/semantic.git synced 2025-01-05 14:11:33 +03:00
semantic/test/JSONTestCase.hs

40 lines
1.7 KiB
Haskell
Raw Normal View History

2016-10-06 02:17:46 +03:00
{-# LANGUAGE DeriveAnyClass #-}
module JSONTestCase where
2016-10-27 01:01:15 +03:00
import Data.Aeson
2016-10-06 02:17:46 +03:00
import Data.Map.Strict as Map
import Prelude
import Prologue
data JSONMetaRepo = JSONMetaRepo { repoPath :: !String
2016-10-27 01:01:15 +03:00
, repoUrl :: !String
2016-10-06 02:17:46 +03:00
, language :: !String
, syntaxes :: ![JSONMetaSyntax]
} deriving (Show, Generic, FromJSON)
2016-10-27 01:01:15 +03:00
data JSONMetaSyntax = JSONMetaSyntax { syntax :: !String
, repoFilePath :: !String
2016-10-06 02:17:46 +03:00
, testCaseFilePath :: !String
2016-10-27 01:01:15 +03:00
, insert :: !String
, replacement :: !String
2016-10-06 02:17:46 +03:00
} deriving (Show, Generic, FromJSON)
2016-10-27 01:01:15 +03:00
data JSONTestCase = JSONTestCase { gitDir :: !String
2016-10-06 02:17:46 +03:00
, testCaseDescription :: !String
2016-10-27 01:01:15 +03:00
, filePaths :: ![String]
, sha1 :: !String
, sha2 :: !String
, expectedResult :: !ExpectedResult
2016-10-06 02:17:46 +03:00
} deriving (Show, Generic, FromJSON)
data ExpectedResult = SummaryResult (Map Text (Map Text [Value]))
| JSONResult (Map Text Value)
| EmptyResult
deriving (Show, Generic, FromJSON)
instance ToJSON ExpectedResult where
toEncoding = genericToEncoding defaultOptions
2016-10-06 02:17:46 +03:00
instance ToJSON JSONTestCase where
toEncoding = genericToEncoding defaultOptions