texrunner 0.0.1.0 → 0.0.1.1
raw patch · 3 files changed
+8/−164 lines, 3 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +5/−0
- tests/Tex/LogParse.hs +0/−160
- texrunner.cabal +3/−4
+ CHANGELOG.md view
@@ -0,0 +1,5 @@+## [v0.0.1.1] (2016-06-06)++- allow `base-4.9`+- fix file capitalisation+
− tests/Tex/LogParse.hs
@@ -1,160 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# OPTIONS_GHC -fno-warn-missing-signatures #-}-module Tex.LogParse where--import Data.ByteString.Lazy.Char8 as B (unlines, ByteString, writeFile)-import Data.Monoid--import Test.HUnit-import Test.Framework.Providers.HUnit-import Test.Framework as F--import System.Texrunner-import System.Texrunner.Parse-import Control.Lens-import Data.Foldable--tests = texTests ++ latexTests ++ contextTests--texTests = [checkErrors "tex error parse" tex]-latexTests = [checkErrors "latex error parse" latex]-contextTests = [checkErrors "context error parse" context]--withHead :: Monad m => [a] -> (a -> m ()) -> m ()-withHead (a:_) f = f a-withHead _ _ = return ()--tex e code = testCase ("tex" ++ show e) $ do- (exitCode, texLog, mPDF) <- runTex "pdftex" [] [] code- take 1 (map error' (texErrors texLog)) @?= [e]--latexHeader, latexBye :: ByteString-latexHeader = B.unlines- [ "\\documentclass{article}"- , "\\begin{document}"- ]-latexBye = "\\end{document}"--latex e code = testCase ("latex" ++ show e) $ do- (exitCode, texLog, mPDF) <- runTex "pdflatex" [] [] (latexHeader <> code)- head (map error' $ texErrors texLog) @?= e--contextHeader, contextBye :: ByteString-contextHeader = "\\starttext"-contextBye = "\\stoptext"--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---- Generating tex sample tex files ----------------------------------------- plain tex--genTexFiles :: IO ()-genTexFiles = for_ labeledErrors mkFile- where- mkFile (nm, (_err, xs)) = ifor_ xs $ \i x -> do- let doc = latexHeader <> x <> latexBye- name | length xs == 1 = nm- | otherwise = nm <> "-" <> show (i+1)- B.writeFile ("tests/samples/tex/" <> name <> ".tex") doc---- latex---- pdflatex -draftmode --interaction=nonstopmode $i--genLatexFiles :: IO ()-genLatexFiles = for_ labeledErrors mkFile- where- mkFile (nm, (_err, xs)) = ifor_ xs $ \i x -> do- let doc = latexHeader <> x <> latexBye- name | length xs == 1 = nm- | otherwise = nm <> "-" <> show (i+1)- B.writeFile ("tests/samples/latex/" <> name <> ".tex") doc---- context tex--genContextFiles :: IO ()-genContextFiles = for_ labeledErrors mkFile- where- mkFile (nm, (_err, xs)) = ifor_ xs $ \i x -> do- let doc = contextHeader <> x <> contextBye- name | length xs == 1 = nm- | otherwise = nm <> "-" <> show (i+1)- B.writeFile ("tests/samples/context/" <> name <> ".tex") doc--labeledErrors =- [ ("missing-dollar", missingDollar)- , ("dimention-too-large", dimensionTooLarge)- , ("illegal-unit", illegalUnit)- , ("missing-number", missingNumber)- , ("undefined-control-sequence", undefinedControlSequence)- ]---- Checking error parsing ------------------------------------------------containsError :: TexLog -> TexError -> Bool-containsError log (TexError _ 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--checkErrors :: TestName -> (TexError' -> ByteString -> F.Test) -> F.Test-checkErrors name f = testGroup name $ map (checkError f) texErrs---- Sample errors ---------------------------------------------------------texErrs =- [ missingDollar- , dimensionTooLarge- , illegalUnit- , missingNumber- , undefinedControlSequence- ]--missingDollar = (,) (Missing '$')- [ "$x+1=2\n\n"- , "$$x+1=2\n\n"- ]--dimensionTooLarge = (,) DimensionTooLarge- [ "\\hskip100000em"- ]--illegalUnit = (,) IllegalUnit- [ "\\hskip1cn"- ]--missingNumber = (,) MissingNumber- [ "\\hskip hi"- ]--undefinedControlSequence = (,) (UndefinedControlSequence "\\hobx")- [ "\\hobx"- ]--------- missingDollarExample2= "x_1"------ missingDollarExample3= "------ numberTooBig = "10000000000"------ overfull = "\\hbox to 1em{overfill box}"------ underfill = "\\hbox to 20em{underfill box}"------ illegalUnit = "\\hskip{1cn}"------ undefinedControlSequence = "\\hobx"------ missingNumber = "\\hskip"--------- missingDollarTest = (texPutStrLn missingDollarExample, MissingDollar)---
texrunner.cabal view
@@ -1,5 +1,5 @@ name: texrunner-version: 0.0.1.0+version: 0.0.1.1 synopsis: Functions for running Tex from Haskell. description: texrunner is an interface to tex that attempts to parse errors and@@ -16,7 +16,7 @@ copyright: 2015 Christopher Chalmers category: System build-type: Simple-extra-source-files: README.md+extra-source-files: README.md, CHANGELOG.md cabal-version: >=1.10 source-repository head type: git@@ -28,7 +28,7 @@ System.Texrunner.Online System.Texrunner.Parse build-depends:- base >=4.6 && <4.9,+ base >=4.6 && <4.10, bytestring >=0.10 && <1.0, filepath, directory >=1.2 && <2.0,@@ -49,7 +49,6 @@ default-language: Haskell2010 other-modules: Tex.PDF- Tex.LogParse build-depends: base,