mirror of
https://github.com/github/semantic.git
synced 2024-12-26 00:12:29 +03:00
Update CommandSpec & SpecHelpers for Maybe returns.
This commit is contained in:
parent
f360b25d16
commit
25b89ada33
@ -143,7 +143,7 @@ data Fixture = Fixture { shas :: Both String, expectedBlobs :: [Both SourceBlob]
|
|||||||
fetchDiffsOutput :: (Object -> Text) -> FilePath -> String -> String -> [(FilePath, Maybe Language)] -> IO Summaries
|
fetchDiffsOutput :: (Object -> Text) -> FilePath -> String -> String -> [(FilePath, Maybe Language)] -> IO Summaries
|
||||||
fetchDiffsOutput f gitDir sha1 sha2 filePaths = do
|
fetchDiffsOutput f gitDir sha1 sha2 filePaths = do
|
||||||
blobPairs <- runCommand $ readFilesAtSHAs gitDir [] filePaths (both sha1 sha2)
|
blobPairs <- runCommand $ readFilesAtSHAs gitDir [] filePaths (both sha1 sha2)
|
||||||
runTask $ distributeFoldMap (Semantic.parseDiffAndRenderBlobPair Renderer.ToCDiffRenderer) blobPairs
|
fromMaybe mempty <$> runTask (distributeFoldMap (Semantic.parseDiffAndRenderBlobPair Renderer.ToCDiffRenderer) blobPairs)
|
||||||
|
|
||||||
-- Diff Summaries payloads look like this:
|
-- Diff Summaries payloads look like this:
|
||||||
-- {
|
-- {
|
||||||
|
@ -27,13 +27,13 @@ import Term
|
|||||||
diffFilePaths :: Both FilePath -> IO ByteString
|
diffFilePaths :: Both FilePath -> IO ByteString
|
||||||
diffFilePaths paths = do
|
diffFilePaths paths = do
|
||||||
blobs <- traverse readFile paths
|
blobs <- traverse readFile paths
|
||||||
runTask $ parseDiffAndRenderBlobPair SExpressionDiffRenderer blobs
|
fromMaybe mempty <$> runTask (parseDiffAndRenderBlobPair SExpressionDiffRenderer blobs)
|
||||||
|
|
||||||
-- | Returns an s-expression parse tree for the specified FilePath.
|
-- | Returns an s-expression parse tree for the specified FilePath.
|
||||||
parseFilePath :: FilePath -> IO ByteString
|
parseFilePath :: FilePath -> IO ByteString
|
||||||
parseFilePath path = do
|
parseFilePath path = do
|
||||||
blob <- readFile path
|
blob <- readFile path
|
||||||
runTask $ parseAndRenderBlob SExpressionTermRenderer blob
|
runTask (parseAndRenderBlob SExpressionTermRenderer blob)
|
||||||
|
|
||||||
-- | Read a file to a SourceBlob.
|
-- | Read a file to a SourceBlob.
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user