Skip to content

Commit

Permalink
Check if the tex error is contained in the log
Browse files Browse the repository at this point in the history
  • Loading branch information
cchalmers committed Aug 28, 2024
1 parent 1a91e0f commit 74123fa
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/Tex/LogParse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ contextHeader, contextBye :: ByteString
contextHeader = "\\starttext"
contextBye = "\\stoptext"

context :: TexError' -> ByteString -> F.Test
context e code = testCase ("context" ++ show e) $ do
(exitCode, texLog, mPDF) <- runTex "context" [] [] (contextHeader <> code)
take 1 (map error' (texErrors texLog)) @?= [e]
-- head (map error' $ texErrors texLog) @?= e
-- assertBool ("context" ++ show e) $ texLog `containsError` e
-- BS.hPutStrLn stderr (rawLog texLog)
assertBool ("context" ++ show e) $ texLog `containsError` e

-- Generating tex sample tex files -------------------------------------

Expand Down Expand Up @@ -96,8 +96,8 @@ labeledErrors =

-- Checking error parsing ----------------------------------------------

containsError :: TexLog -> TexError -> Bool
containsError log (TexError _ err) = err `elem` map error' (texErrors log)
containsError :: TexLog -> TexError' -> Bool
containsError log err = err `elem` map error' (texErrors log)

checkError :: (TexError' -> ByteString -> F.Test) -> (TexError', [ByteString]) -> F.Test
checkError f (e, codes) = testGroup (show e) $ map (f e) codes
Expand Down

0 comments on commit 74123fa

Please sign in to comment.