lentil 1.0.2.0 → 1.0.3.0
raw patch · 24 files changed
+217/−177 lines, 24 files
Files
- changes.txt +9/−0
- contributors.txt +1/−0
- doc/usr/page.rst +9/−1
- issues.txt +22/−50
- lentil.cabal +5/−2
- src/Lentil/Args.hs +4/−32
- src/Lentil/Export.hs +5/−5
- src/Lentil/File.hs +4/−16
- src/Lentil/Parse/Issue.hs +2/−9
- src/Lentil/Parse/Source.hs +34/−13
- src/Lentil/Parse/Syntaxes.hs +31/−17
- src/Lentil/Types.hs +6/−0
- src/Main.hs +2/−3
- test/Lentil/ArgsSpec.hs +14/−8
- test/Lentil/ExportSpec.hs +2/−2
- test/Lentil/Parse/IssueSpec.hs +1/−1
- test/Lentil/Parse/RunSpec.hs +12/−0
- test/Lentil/Parse/SourceSpec.hs +13/−6
- test/Tests.hs +0/−3
- test/test-files/lang-comm/erlang.erl +11/−0
- test/test-files/lang-comm/ocaml.ml +9/−0
- test/test-files/lang-comm/rust.rs +12/−0
- test/test-files/lang-comm/standard-ml.sml +9/−0
- test/test-files/lang-comm/text.txt +0/−9
changes.txt view
@@ -1,3 +1,12 @@+1.0.3.0+-------++- Released Tue 06 Sep 2016 19:49:32 CEST+- Added Erlang (and YECC, Erlang FLEX), Ocaml, Rust,+ SML support (request by Tuncer Ayaz).+- Added OpenGL Shading Language support (request by+ qptain nemo).+ 1.0.2.0 -------
contributors.txt view
@@ -5,6 +5,7 @@ Anton Felix Lorenzen Francesco Mazzoli Simon Michael+Luca Molteni Qptain Nemo Mats Rauhala Stefano Rodighiero
doc/usr/page.rst view
@@ -171,6 +171,12 @@ - shell script source files (``.sh``) - nix source files (``.nix``) - xml source files (``.xml``, ``.html``)+- Erlang source files (``.erl``, ``.hrl``, ``.escript``) including YECC+ (``.yrl``) and FLEX (``.xrl``)+- OCaml source files (``.ml``, ``.mli``)+- Rust source files (``.rs``, ``.rlib``)+- Standard ML source files (``.sml``)+- OpenGL Shading Language source files (``.glsl``) - plain text files (``.txt``) If you want a file type ``.xyz`` to be recognised as one in the list above,@@ -184,7 +190,9 @@ lentil . -a xyz%cpp -a qkw%js but please *please* **please** contact me to have the extension(s) included-in `lentil` natively, as this will make the program more convenient to use.+in `lentil` natively, as this will make the program more convenient to use+(if you want to speed up the process, please include a description of the+comment syntax and string/character syntax too). .. raw:: html
issues.txt view
@@ -1,62 +1,46 @@ bin/make-bins.hs- 21 auto search (global? cpp?) version number? [dist]+ 21 auto search (global? cpp?) version number? forse shake? [dist] doc/dev/issues.txt- 11 have stuff linked to haskell-platform friendly e non template- haskell and stuff [feature:intermediate]- 13 html report, come hlint [feature:advanced]- 14 symlinks? [feature:intermediate]- 15 check --output pretty, there are trailing white spaces [bug] [u:1]- 16 autoignore non-text files? (binary, images, bloom filter) [2016]- 17 sm: issue numbers is valuable [design] [request]- 18 sm: have a way to link to discussion/history of issue [design]+ 11 html report, come hlint [feature:advanced]+ 12 symlinks? [feature:intermediate]+ 13 check --output pretty, there are trailing white spaces [bug] [u:1]+ 14 sm: issue numbers is valuable [design] [request]+ 15 sm: have a way to link to discussion/history of issue [design] [request]- 19 sm: 1. lentil autogenerates numbers where missing adding tags, 2.+ 16 sm: 1. lentil autogenerates numbers where missing adding tags, 2. creates an associated numbered file in .issues/, displays associated notes written in those files is asked, 3. even update them when there is a source change. (4) these files could be webserved when they want something linkable. Vedi comments in doc/dev/issues.txt [design] [request]- 25 chickpea, lentil's brother. Two commands, add number to numberless+ 22 chickpea, lentil's brother. Two commands, add number to numberless tag (#1212 or something), create a mini db with those issues, which automatically updated and you can even write stuff in there. O maybe you can even add lentil, chickpea and quinoa. Vedi more in doc/dev/issues.txt [design]- 31 way to 'group' (section) output by tag [feature:advanced]- 32 win (and mac?) builds [package] [u:3] [2016]- 33 Henning: don't output nothing on lentil xxx.cabal (maybe add 19+ 28 way to 'group' (section) output by tag [feature:advanced]+ 29 win (and mac?) builds [package] [u:2] [2016]+ 30 Henning: don't output nothing on lentil xxx.cabal (maybe add 19 skipped?) [request] [2016]- 34 code coverage [test]- 35 add .lentilignore (or even .lentilconf) Michał Antkiewicz+ 31 code coverage [test] [u:2]+ 32 add .lentilignore (or even .lentilconf) Michał Antkiewicz [feature:intermediate] [request]- 37 - https://blog.steve.org.uk/If_line_noise_is_a_program__all_fuzzers_are_developers.html- in lentil? [debug] [u:2]- 38 parsing with http://awgn.github.io/cgrep/ [design]+ 34 + https://blog.steve.org.uk/If_line_noise_is_a_program__all_fuzzers_are_developers.html+ in lentil? [debug] [u:2] src/Lentil/Args.hs 26 disambiguation optparse-applicative [feature:intermediate] 27 help as lentil PATH [ PATH... ] [ OPTIONS ] [feature:intermediate]- 111 uncomment and implement sorting [feature:intermediate] src/Lentil/Export.hs 36 maybe use a dedicated library to format xml? [design] src/Lentil/File.hs- 41 not using canonised paths because it is extremely slow on big- repositories (like darcs). Explore different possibilities- (conduit, new Filepath, unix program). [u:2] [duct]- 57 apparently toListM is not idiomatic [refactor] [duct]- 68 use pipes-files when released [feature:intermediate]- 80 combine funziona su windows? [feature:intermediate]- -src/Lentil/Parse/Issue.hs- 30 "feature" flagword could (in theory) clash with a free-text comment- (if it is present in the middle of a sentence at the beginning of a- line). Consider alternatives (as: making new words configurable in- .lentil dotfile. After checking the linux kernel, it definitely is.- Erase it and possibly make it an option [design] [u:3] [bug]- 112 applicative style possible? [u:1] [refactor]+ 53 apparently toListM is not idiomatic [refactor] [duct]+ 64 use pipes-files when released [feature:intermediate]+ 76 combine funziona su windows? [test] src/Lentil/Parse/Run.hs 58 a function String -> [Issue]@@ -66,21 +50,9 @@ tuples section! [refactor] [duct] src/Lentil/Parse/Syntaxes.hs- 33 add langparsers che sia estensibile e leggibile a compilazione- [u:2] [feature:intermediate]- 60 multiline signature? [lint]- -src/Main.hs- 41 leave sort out as now? [design]- 58 o ord? [fixme]- -test/Lentil/ArgsSpec.hs- 38 real parsing testing options [test]+ 25 qptain_nemo fake multiline comments in C (i.e. // and \ at the+ bottom of the line, continued into next line, are valid C comments+ but not recognised by lentil [u:1] [request] test/Lentil/FileSpec.hs 38 excluding files fails on MS Windows! Check why! [u:3] [bug]- -test/Tests.hs- 4 - http://hackage.haskell.org/package/mockery-0.3.0/docs/Test-Mockery-Directory.html- instead of folder use this? [refactor]
lentil.cabal view
@@ -1,5 +1,5 @@ name: lentil-version: 1.0.2.0+version: 1.0.3.0 synopsis: frugal issue tracker description: minumum effort, cohesive issue tracker based on ubiquitous @TODO@s and @FIXME@s conventions.@@ -25,8 +25,11 @@ test/test-files/lang-comm/shell.sh, test/test-files/lang-comm/nix.nix, test/test-files/lang-comm/xml.xml,+ test/test-files/lang-comm/erlang.erl,+ test/test-files/lang-comm/ocaml.ml,+ test/test-files/lang-comm/rust.rs,+ test/test-files/lang-comm/standard-ml.sml, test/test-files/lang-comm/test.txt,- test/test-files/lang-comm/text.txt, test/test-files/specific/contiguous.c, test/test-files/specific/cont-custom.c, test/test-files/specific/uppercase.C,
src/Lentil/Args.hs view
@@ -90,9 +90,10 @@ flagword :: Parser FlagWord-flagword = strOption ( short 'w' <>- metavar "FLAGWORD" <>- help ("additional flagword (e.g.: -w Hack)") )+flagword = fmap normaliseFlagword $+ strOption ( short 'w' <>+ metavar "FLAGWORD" <>+ help "additional flagword (e.g.: -w Hack)" ) outfile :: Parser (Maybe FilePath)@@ -106,35 +107,6 @@ issort :: Parser [LSort] issort = pure [] -{--- TODO: uncomment and implement sorting [feature:intermediate]--issort :: Parser [LSort]-issort = option (str >>= parseSorts)- ( long "sort" <>- short 's' <>- metavar "[!]ORDER[,[!]ORDER ...]" <>- value [] <>- help "sort order, comma separated (path, desc, label). \- \'!' orders in descending fashion. Check manual for \- \examples" )- -- TODO: sort parsing? [feature:intermediate]- where parseSorts :: String -> ReadM [LSort]- parseSorts cs = mapM parSort . words . replace ',' ' ' $ cs-- -- this parsort is broken [bug] [duct]- parSort :: String -> ReadM LSort- parSort "path" = return (sortIssues iFile Asc)- parSort "desc" = return (sortIssues iDesc Asc)- parSort "!path" = return (sortIssues iFile Desc)- parSort "!desc" = return (sortIssues iDesc Desc)- parSort _ = error "lol"-- replace :: Char -> Char -> String -> String- replace a b cs = map (\c -> if c == a then b else c) cs---} ------------------- -- FILTER PARAMS --
src/Lentil/Export.hs view
@@ -36,18 +36,18 @@ -- TODO: maybe use a dedicated library to format xml? [design] -- xml output issues2Xml :: [Issue] -> String-issues2Xml is = concat ["<issues>", concat (map is2x (groupBy is)), "</issues>", "\n"]+issues2Xml is = concat ["<issues>", concatMap is2x (groupBy is), "</issues>", "\n"] where i2x i = concat ["<issue>", "<row>", show (iRow i), "</row>", maybe "" d2x (iDesc i),- "<tags>", concat (map t2x (iTags i)), "</tags>",+ "<tags>", concatMap t2x (iTags i), "</tags>", "</issue>"] d2x d = concat ["<description>", cdata d, "</description>"] t2x t = concat ["<tag>", tagString t, "</tag>"] is2x [] = "" is2x is'@(i:_) = let fp = file i- in concat ["<file>", "<filename>", cdata fp, "</filename>", concat (map i2x is'), "</file>"]+ in concat ["<file>", "<filename>", cdata fp, "</filename>", concatMap i2x is', "</file>"] cdata x = concat ["<![CDATA[", x, "]]>"] file = prettyFP . iFile groupBy = L.groupBy ((==) `on` file)@@ -63,6 +63,6 @@ -- [tag1] [tag2] etc. tags2StringPretty :: [Tag] -> String-tags2StringPretty ts = L.intercalate " " .- map ((openDel:) . (++[closeDel]) . tagString) $ ts+tags2StringPretty ts = unwords . map ((openDel:) .+ (++[closeDel]) . tagString) $ ts
src/Lentil/File.hs view
@@ -38,15 +38,11 @@ -- FILESCAN -- -------------- --- todo: not using canonised paths because it is extremely slow on big--- repositories (like darcs). Explore different possibilities--- (conduit, new Filepath, unix program). [u:2] [duct]- findIssues :: [Alias] -> [FlagWord] -> [FilePath] -> [FilePath] -> IO [Issue] findIssues as fws fps xs =- findFiles as fps xs >>= \fl ->- (fmap concat $ PP.toListM $ finalPipe fl) >>= \r ->+ findFiles as fps xs >>= \fl ->+ fmap concat (PP.toListM $ finalPipe fl) >>= \r -> perrEph "\r" >> -- clean progress bar return r where@@ -77,7 +73,7 @@ where fp2fc :: FilePath -> FindClause Any fp2fc f = Any . L.isPrefixOf f <$> filePath- -- TODO: combine funziona su windows? [feature:intermediate]+ -- TODO: combine funziona su windows? [test] extCheck = (fmap getAny . mconcat) (map (fmap Any . (extension ==?)) (extensionList as))@@ -89,15 +85,7 @@ recPred = (not . isDotFolder) <$> fileName where isDotFolder "." = False -- not curr dir!- isDotFolder fp | length fp == 0 = False+ isDotFolder fp | null fp = False | L.elem (head fp) ['.', '_'] = True isDotFolder _ = False---- -- canonicalizePath with exceptions to stderr--- canonPaths :: [FilePath] -> IO [FilePath]--- canonPaths ps = (mapM (try . canonicalizePath) ps--- :: IO [Either SomeException FilePath]) >>= \ecs ->--- let (ls, rs) = partitionEithers ecs in--- mapM_ (perr . ("canonPath: " ++) . show) ls >>--- return rs
src/Lentil/Parse/Issue.hs view
@@ -16,7 +16,6 @@ import Control.Applicative hiding ( (<|>), optional, many ) import qualified Data.Char as C-import qualified Data.String as S import Prelude -- 7.8 hack @@ -35,10 +34,6 @@ flagWords :: ParIssue [FlagWord] flagWords = fmap (stdFlagwords ++) getState --- all to lower-normaliseFlagword :: FlagWord -> FlagWord-normaliseFlagword t = map C.toLower t- --------------- -- PRIMITIVE -- ---------------@@ -102,10 +97,8 @@ return (normaliseFlagword fw) <?> "incipit" where- -- todo [u:1] [refactor] applicative style possible? fwpar = flagWords >>= \fw ->- choice (map (try . ciString) fw) >>=- return . S.fromString+ choice (map (try . ciString) fw) ------------@@ -130,7 +123,7 @@ mkIssue fw fp ln tg1 ds tg2 = Issue fp ln ds (addTag fw (tg1++tg2)) addTag "todo" tgs = tgs- addTag fw tgs = (Tag $ normaliseFlagword fw) : tgs+ addTag fw tgs = (Tag fw) : tgs
src/Lentil/Parse/Source.hs view
@@ -34,12 +34,15 @@ psBlockComms :: [(String, String)], psStringStyle :: EscapeStyle, psStringLits :: [Char],+ psCharStyle :: CharStyle, psCharLits :: [Char] } deriving (Show) data EscapeStyle = ClangLike | SQLLike deriving (Show, Eq) +data CharStyle = CommonChr | ErlangChr+ deriving (Show, Eq) -------------- -- COMMENTS --@@ -52,9 +55,14 @@ -- parses stuff like "-- comment" lineComment :: String -> ParSource CommentString lineComment s = SingleLine <$>- (string s *> getRow) <*>- (manyTill anyChar newline)+ (initId s *> getRow) <*>+ manyTill anyChar newline <?> "line comment"+ where+ -- for 1-char line comments (#, ;, etc.), erases repeating+ initId :: String -> ParSource ()+ initId [a] = () <$ many1 (char a)+ initId as = () <$ string as blockComment :: (String, String) -> ParSource CommentString blockComment (i, e) = MultiLine <$>@@ -90,18 +98,29 @@ -- because the content is meaningless to our program ---------------------- OTHER BLOCKS ---------------------+-----------+-- CHARS --+----------- +litChar :: CharStyle -> Char -> ParSource Char+litChar CommonChr ic = commonChar ic+litChar ErlangChr ic = erlangChar ic -- quoted single character-litChar :: Char -> ParSource Char-litChar ic = q *> ((char '\\' *> anyChar) <|> anyChar) <* q+commonChar :: Char -> ParSource Char+commonChar ic = q *> ((char '\\' *> anyChar) <|> anyChar) <* q <?> "char string sign" where q = char ic +-- $a for 'a' (where ic = '$')+erlangChar :: Char -> ParSource Char+erlangChar ic = char ic *> anyChar ++------------------+-- OTHER BLOCKS --+------------------+ -- a program is instructions to the computer. Ends when you meet -- a well formed element from above (linecomm, blockcom, stringlit, -- charLit)@@ -119,7 +138,8 @@ -- ambiguous symbols (pall'aaa'foo is valid haskell identifier, -- so it should stay here- lchars = "" <$ choice (map litChar (psCharLits ps))+ lchars = "" <$ choice (map (litChar (psCharStyle ps))+ (psCharLits ps)) ------------@@ -128,17 +148,18 @@ -- given a set of lineparsers / blockparsers sourcePart :: ParSyntax -> ParSource (Maybe CommentString)-sourcePart ps@(ParSyntax lc bc es sl cl) = choice [plc, pbc, psl, pcl, ppr]+sourcePart ps@(ParSyntax lc bc es sl cs cl) =+ choice [plc, pbc, psl, pcl, ppr] <?> "source file part" where ct = choice . map try plc = Just <$> (ct . map lineComment $ lc) -- line comlm pbc = Just <$> (ct . map blockComment $ bc) -- block comm- psl = Nothing <$ (choice . map try . map (litString es) $ sl)- -- str lit- pcl = Nothing <$ (ct . map litChar $ cl) -- char lit- ppr = Nothing <$ program ps -- program+ psl = Nothing <$ (choice . map (try . litString es) $ sl)+ -- str lit+ pcl = Nothing <$ (ct . map (litChar cs) $ cl) -- char lit+ ppr = Nothing <$ program ps -- program -- ps: syntax to sever comment from the rest source :: ParSyntax -> ParSource [CommentString]
src/Lentil/Parse/Syntaxes.hs view
@@ -22,6 +22,10 @@ type MaybePar = Maybe (ParSource [CommentString]) +-- todo [u:1] [request] qptain_nemo fake multiline comments in C+-- (i.e. // and \ at the bottom of the line, continued into+-- next line, are valid C comments but not recognised by lentil+ -- as langParser, with alias added langParserAlias :: [Alias] -> String -> MaybePar langParserAlias as fp = maybe (langParser fp) langParser (lookup ext as)@@ -30,9 +34,6 @@ extensionList :: [Alias] -> [String] extensionList as = concatMap fst languages ++ map fst as --- TODO: add langparsers che sia estensibile e leggibile--- a compilazione [u:2] [feature:intermediate]- langParser :: String -> MaybePar langParser fp = lookupExt languages ext where ext = map C.toLower (SF.takeExtension fp)@@ -45,6 +46,8 @@ ([".c", ".h"], Just c), ([".cpp", ".hpp"], Just c), -- C++ ([".java"], Just c), -- Java+ ([".glsl"], Just c), -- GL Shader+ ([".xrl"], Just c), -- FLEX ([".js"], Just javascript), ([".ts"], Just javascript), -- TypeScript ([".pas", ".pp", ".inc"], Just pascal),@@ -55,32 +58,43 @@ ([".sh"], Just perl), -- shell ([".nix"], Just nix), ([".xml", ".html"], Just xml),+ ([".erl", ".hrl",+ ".escript", ".yrl"], Just erlang),+ ([".ml", ".mli"], Just ocaml),+ ([".rs", ".rlib"], Just rust),+ ([".sml"], Just sml), ([".txt"], Just text) ] --- todo multiline signature? [lint]-haskell, c, javascript, pascal, python, ruby :: ParSource [CommentString]-perl, nix :: ParSource [CommentString]-text :: ParSource [CommentString]-xml :: ParSource [CommentString]+haskell, c, javascript, pascal, python, ruby, perl, nix,+ xml, erlang, ocaml, rust, sml, text :: ParSource [CommentString] haskell = source $ ParSyntax ["--"] [("{-", "-}")]- ClangLike ['"'] ['\'']+ ClangLike ['"'] CommonChr ['\''] c = source $ ParSyntax ["//"] [("/*", "*/")]- ClangLike ['"'] ['\'']+ ClangLike ['"'] CommonChr ['\''] javascript = source $ ParSyntax ["//"] [("/*", "*/")]- ClangLike ['"', '\''] []+ ClangLike ['"', '\''] CommonChr [] pascal = source $ ParSyntax ["//"] [("{", "}" ), ("(*", "*)")]- SQLLike ['\''] []+ SQLLike ['\''] CommonChr [] python = source $ ParSyntax ["#"] [("\"\"\"", "\"\"\"")]- ClangLike ['"', '\''] []+ ClangLike ['"', '\''] CommonChr [] ruby = source $ ParSyntax ["#"] [("=begin", "=end")]- ClangLike ['"', '\''] []+ ClangLike ['"', '\''] CommonChr [] perl = source $ ParSyntax ["#"] []- ClangLike ['"', '\''] []+ ClangLike ['"', '\''] CommonChr [] nix = source $ ParSyntax ["#"] [("/*", "*/")]- ClangLike ['"'] ['\'']+ ClangLike ['"'] CommonChr ['\''] xml = source $ ParSyntax [] [("<!--", "-->")]- ClangLike ['"', '\''] []+ ClangLike ['"', '\''] CommonChr []+erlang = source $ ParSyntax ["%"] []+ ClangLike ['"'] ErlangChr ['$']+ocaml = source $ ParSyntax [] [("(*", "*)")]+ ClangLike ['"', '\''] CommonChr []+rust = source $ ParSyntax ["//!", "///", "//"] []+ ClangLike ['"', '\''] CommonChr []+sml = source $ ParSyntax [] [("(*", "*)")]+ ClangLike ['"'] CommonChr [] text = (:[]) . MultiLine 1 <$> many anyChar+ -- ANCILLARIES --
src/Lentil/Types.hs view
@@ -11,6 +11,7 @@ import qualified Data.List as L+import qualified Data.Char as C data Issue = Issue { iFile :: FilePath,@@ -33,6 +34,11 @@ -- Flagwords are string (TODO, FIXME, etc.) type FlagWord = String++-- all to lower+normaliseFlagword :: FlagWord -> FlagWord+normaliseFlagword t = map C.toLower t+ -- output format data Format = TagPop | Pretty | Csv | Comp | Xml
src/Main.hs view
@@ -28,7 +28,7 @@ short 'v' <> help "show version and copyright info" ) where- versionCopy = "\nlentil - frugal issue tracker, version 1.0.2.0\n\+ versionCopy = "\nlentil - frugal issue tracker, version 1.0.3.0\n\ \(C) 2015-2016 Francesco Ariis - http://www.ariis.it\n\ \released under the GNU General Public License v3\n" @@ -38,7 +38,6 @@ (loInExcl lo) >>= \is -> -- grab issues let fil = filterAnd (loFilters lo) is -- filtered -- ord = chainSorts fil (loSort lo) -- ordered- -- todo leave sort out as now? [design] -- which function to use to output stuff (file/term) outFunction :: String -> IO ()@@ -55,7 +54,7 @@ in case loFormat lo of- Pretty -> outFunction (ppIssues bCol fil) -- fixme o ord?+ Pretty -> outFunction (ppIssues bCol fil) TagPop -> outFunction (ppPopularity bCol fil) Csv -> outFunction (issues2CSV fil) Comp -> outFunction (issues2Compiler fil)
test/Lentil/ArgsSpec.hs view
@@ -6,22 +6,30 @@ import Lentil.Query import Lentil.Args +import qualified Options.Applicative as OA + -- TEST VARS -- testOpt :: LOptions testOpt = LOptions (["alpha"], ["beta"]) Csv [filterFilepath "al", negFilter . filterTags $ "."]- [] [("qq","s")] ["hax", "ke"] (Just "foo.txt")+ [] [(".qq",".s")] ["hax", "ke"] (Just "foo.txt") ins :: [String]-ins = words "alpha --format csv -x beta -p al -t ^ --a qq-s \+ins = words "alpha -f csv -x beta -p al -t ^ -a qq%s \ \--output foo.txt -w Hax -w ke" --- out :: Maybe LOptions--- out = getParseResult .- -- execParserPure M.mempty (info lOpts (fullDesc)) $ ins+readOpts :: [String] -> Maybe LOptions+readOpts i = OA.getParseResult $ OA.execParserPure OA.defaultPrefs parInfo i+ where+ parInfo = OA.info lOpts OA.fullDesc +-- convert an LOptions type to something we can compare/show (eliminates+-- LFilter, LSort)+convComp :: LOptions -> (([FilePath], [FilePath]), Format,+ [Alias], [FlagWord], Maybe FilePath)+convComp (LOptions ix fr _ _ al fw ou) = (ix, fr, al, fw, ou) -- TESTING -- @@ -33,7 +41,5 @@ describe "lOpts" $ do it "parses options" $- ins `shouldBe` ins- --error "args" --out `shouldBe` Just testOpt- -- TODO: real parsing testing options [test]+ fmap convComp (readOpts ins) `shouldBe` Just (convComp testOpt)
test/Lentil/ExportSpec.hs view
@@ -17,7 +17,7 @@ \\"file\",\"2\",\"db\",\"e:f\"" cmp :: String-cmp = unlines $+cmp = unlines ["file:1:", " da [a] [c]", "",@@ -25,7 +25,7 @@ " db [e:f]"] xml :: String-xml = concat $+xml = concat ["<issues><file><filename><![CDATA[file]]></filename>" , "<issue><row>1</row><description><![CDATA[da]]></description>" , "<tags><tag>a</tag><tag>c</tag></tags>"
test/Lentil/Parse/IssueSpec.hs view
@@ -164,5 +164,5 @@ `shouldBe` Just [Issue "<f>" 2 (Just "this is it") [], Issue "<f>" 3 (Just "hey") [Tag "t"]] it "doesn't pick issues in the middle of a sentence" $- sp [] issues "\nthis is not a todo as you can see" `shouldBe` (Just [])+ sp [] issues "\nthis is not a todo as you can see" `shouldBe` Just []
test/Lentil/Parse/RunSpec.hs view
@@ -92,4 +92,16 @@ it "parses an Xml source" $ fileParser [] [] "test/test-files/lang-comm/xml.xml" `shouldReturn` spt "test/test-files/lang-comm/xml.xml"+ it "parses an erlang source" $+ fileParser [] [] "test/test-files/lang-comm/erlang.erl"+ `shouldReturn` spt "test/test-files/lang-comm/erlang.erl"+ it "parses an OCaml source" $+ fileParser [] [] "test/test-files/lang-comm/ocaml.ml"+ `shouldReturn` spt "test/test-files/lang-comm/ocaml.ml"+ it "parses a Rust source" $+ fileParser [] [] "test/test-files/lang-comm/rust.rs"+ `shouldReturn` spt "test/test-files/lang-comm/rust.rs"+ it "parses a Standard ML source" $+ fileParser [] [] "test/test-files/lang-comm/standard-ml.sml"+ `shouldReturn` spt "test/test-files/lang-comm/standard-ml.sml"
test/Lentil/Parse/SourceSpec.hs view
@@ -34,6 +34,10 @@ sp (lineComment "//") "// Test\n" `shouldBe` Just (sl 1 " Test") it "fails without trailing \\n" $ sp (lineComment "//") "// Test" `shouldBe` Nothing+ it "for single-char line-comments, erases repeating of such char" $+ sp (lineComment "#") "## Test\n" `shouldBe` Just (sl 1 " Test")+ it "does not erease repeating for multi-char line-comments" $+ sp (lineComment "//") "//// Test\n" `shouldBe` Just (sl 1 "// Test") describe "blockComment" $ do it "parses a block comment" $@@ -51,12 +55,15 @@ sp (litString SQLLike '\'') "\'\\\'" `shouldBe` Just "\\" describe "litChar" $ do- it "parses a string literal character inside" $- sp (litChar '\'') "'a'" `shouldBe` Just 'a'- it "parses escaped characters too" $- sp (litChar '\'') "'\"'" `shouldBe` Just '\"'+ it "parses a string literal character inside (common)" $+ sp (litChar CommonChr '\'') "'a'" `shouldBe` Just 'a'+ it "parses escaped characters too (common)" $+ sp (litChar CommonChr '\'') "'\"'" `shouldBe` Just '\"'+ it "parses an erlang-style char" $+ sp (litChar ErlangChr '$') "$%" `shouldBe` Just '%' - let hss = ParSyntax ["--"] [("{-", "-}")] ClangLike ['"'] ['\'']+ let hss = ParSyntax ["--"] [("{-", "-}")]+ ClangLike ['"'] CommonChr ['\''] describe "program" $ do it "parses program instructions till eof" $ sp (program hss) "prova " `shouldBe` Just "prova "@@ -71,7 +78,7 @@ it "stops at ' which is not a literal char" $ sp (program hss) "prova' " `shouldBe` Just "prova' " - let rbs = ParSyntax ["#"] [] ClangLike ['"', '\''] []+ let rbs = ParSyntax ["#"] [] ClangLike ['"', '\''] CommonChr [] describe "source" $ do it "parses one piece of source (line-comment)" $ sp (source hss) "-- hey\n my " `shouldBe` Just [sl 1 " hey"]
test/Tests.hs view
@@ -1,6 +1,3 @@ {-# OPTIONS_GHC -F -pgmF hspec-discover #-} --- TODO: http://hackage.haskell.org/package/mockery-0.3.0/docs/Test-Mockery-Directory.html--- instead of folder use this? [refactor]-
+ test/test-files/lang-comm/erlang.erl view
@@ -0,0 +1,11 @@+% TODO: single+% comment+%% todo single2++io:format("Got hel%lo message: ~s" 'atom') % string+cad(a) = [$% todo] % char++% todo block1+% todo block2 [tog]++%% end
+ test/test-files/lang-comm/ocaml.ml view
@@ -0,0 +1,9 @@+(* TODO: single+ comment *)+(* todo single2 *)++let someOther = " \" "+let myChar = '\n' (* toast *)++(* todo block1 *)+(* todo block2 [tog] *)
+ test/test-files/lang-comm/rust.rs view
@@ -0,0 +1,12 @@+// todo single+// comment+/// Todo: single2++let c = "st/*ring"; //! string+let letter = 'c' // char++//! TODO: block1+//! TODO: block2 [tog]+++// end
+ test/test-files/lang-comm/standard-ml.sml view
@@ -0,0 +1,9 @@+(* TODO: single+ comment *)+(* todo single2 *)++let someOther = " (* "+let myChar = "\n" (* toast *)++(* todo block1 *)+(* todo block2 [tog] *)
− test/test-files/lang-comm/text.txt
@@ -1,9 +0,0 @@-todo single-comment-TODO single2-- string--- todo block1- todo block2 [tog]