sort-imports/test/Spec.hs
2023-07-24 13:37:49 -04:00

20 lines
754 B
Haskell

import SortImports
import SortImports.Types
import Test.Tasty
import Test.Tasty.HUnit
main :: IO ()
main = defaultMain $ testGroup "Tests" [unitTests]
unitTests :: TestTree
unitTests = testGroup "Unit tests"
[ testCase "" $
lineType Nothing "not a module" @?= CodeLine "not a module"
, testCase "bare" $
lineType Nothing "import ModuleName" @?= ModuleLine (Module Nothing "ModuleName" Nothing Nothing)
, testCase "pre-qualified" $
lineType Nothing "import qualified ModuleName" @?= ModuleLine (Module (Just Qualified_Pre) "ModuleName" Nothing Nothing)
, testCase "post-qualified" $
lineType Nothing "import ModuleName qualified as Mod" @?= ModuleLine (Module (Just Qualified_Post) "ModuleName" (Just "Mod") Nothing)
]