1
1
mirror of https://github.com/github/semantic.git synced 2024-11-29 02:44:36 +03:00

Expect diff headers

This commit is contained in:
joshvera 2016-02-22 14:04:39 -07:00
parent d7db984616
commit 35355a2e91
3 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,7 @@ import Renderer
import Split
import Unified
import qualified Source as S
import Control.DeepSeq
import Data.Bifunctor.Join
import qualified Data.ByteString.Char8 as B1
@ -78,7 +79,9 @@ testDiff :: Renderer T.Text String -> FilePath -> FilePath -> Maybe FilePath ->
testDiff renderer a b diff matcher = do
let parser = parserForFilepath a
sources <- sequence $ readAndTranscodeFile <$> Join (a, b)
actual <- diffFiles parser renderer (runJoin sources)
let srcs = runJoin sources
let sourceBlobs = (S.SourceBlob (fst srcs) mempty a, S.SourceBlob (snd srcs) mempty b)
actual <- diffFiles parser renderer sourceBlobs
case diff of
Nothing -> actual `deepseq` matcher (actual, actual)
Just file -> do

View File

@ -1,3 +1,5 @@
diff --git a/test/diffs/newline-at-eof.A.js b/test/diffs/newline-at-eof.B.js
index ..
@@ -1,2 +1,4 @@
console.log("hello, world");

View File

@ -1,3 +1,5 @@
diff --git a/test/diffs/no-newline-at-eof.A.js b/test/diffs/no-newline-at-eof.B.js
index ..
@@ -1,1 +1,3 @@
console.log("hello, world");