packages feed

lentil-1.0.2.0: test/Lentil/ArgsSpec.hs

module Lentil.ArgsSpec where

import Test.Hspec

import Lentil.Types
import Lentil.Query
import Lentil.Args


-- TEST VARS --

testOpt :: LOptions
testOpt = LOptions (["alpha"], ["beta"]) Csv
                   [filterFilepath "al", negFilter . filterTags $ "."]
                   [] [("qq","s")] ["hax", "ke"] (Just "foo.txt")

ins :: [String]
ins  = words "alpha --format 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


-- TESTING --

main :: IO ()
main = hspec spec

spec :: Spec
spec = do

  describe "lOpts" $ do
    it "parses options" $
      ins `shouldBe` ins
      --error "args" --out `shouldBe` Just testOpt
      -- TODO: real parsing testing options [test]