2021-09-14 21:56:10 -04:00
|
|
|
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 "" $
|
2023-07-24 13:37:49 -04:00
|
|
|
lineType Nothing "not a module" @?= CodeLine "not a module"
|
2023-07-17 15:05:11 -04:00
|
|
|
, testCase "bare" $
|
2023-07-24 13:37:49 -04:00
|
|
|
lineType Nothing "import ModuleName" @?= ModuleLine (Module Nothing "ModuleName" Nothing Nothing)
|
2023-07-17 15:05:11 -04:00
|
|
|
, testCase "pre-qualified" $
|
2023-07-24 13:37:49 -04:00
|
|
|
lineType Nothing "import qualified ModuleName" @?= ModuleLine (Module (Just Qualified_Pre) "ModuleName" Nothing Nothing)
|
2023-07-17 15:05:11 -04:00
|
|
|
, testCase "post-qualified" $
|
2023-07-24 13:37:49 -04:00
|
|
|
lineType Nothing "import ModuleName qualified as Mod" @?= ModuleLine (Module (Just Qualified_Post) "ModuleName" (Just "Mod") Nothing)
|
2021-09-14 21:56:10 -04:00
|
|
|
]
|