Move code to Internal module and add tests

This commit is contained in:
Alexander Kobjolke 2023-08-15 19:47:37 +02:00
parent 2ac76cb650
commit ace38dcebc
6 changed files with 89 additions and 15 deletions

15
test/HCatSpec.hs Normal file
View file

@ -0,0 +1,15 @@
{-# LANGUAGE GHC2021 #-}
module HCatSpec (spec) where
import HCat.Internal (parseArgs)
import Test.Hspec
spec :: Spec
spec = do
describe "parseArgs" do
it "returns the filename if given a single argument" do
parseArgs ["foo"] `shouldBe` Right "foo"
parseArgs [] `shouldBe` Left "No filename given!"
parseArgs ["foo", "bar"] `shouldBe` Left "Only a single file is supported"