Skip to content

Commit

Permalink
Tests: error on unused imports (#45)
Browse files Browse the repository at this point in the history
And update imports.
  • Loading branch information
acl-cqc authored Oct 25, 2024
1 parent c6c6f83 commit 1d99dd2
Show file tree
Hide file tree
Showing 13 changed files with 9 additions and 45 deletions.
2 changes: 2 additions & 0 deletions brat/brat.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ test-suite tests
import: ghc-perf, haskell
type: exitcode-stdio-1.0
default-language: GHC2021
ghc-options:
-Werror=unused-imports
hs-source-dirs: test
main-is: Main.hs
other-modules: Test.Abstractor,
Expand Down
1 change: 0 additions & 1 deletion brat/test/Test/Abstractor.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import Test.Tasty.QuickCheck

import Brat.Syntax.Abstractor
import Brat.Syntax.Simple
import Brat.UserName
import Util

abstractor :: Int -> Gen Abstractor
Expand Down
8 changes: 0 additions & 8 deletions brat/test/Test/Checking.hs
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
module Test.Checking (getCheckingTests, expectedCheckingFails) where

import Brat.Checker (run)
import Brat.Checker.Monad (Checking)
import Brat.Checker.Types (TypedHole)
import Brat.Error (Error)
import Brat.Graph (Graph)
import Brat.Naming (root)
import Test.Parsing (expectedParsingFails, expectFailForPaths)
import Test.Util (parseAndCheck)

import System.FilePath
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.Silver
import Test.Tasty.ExpectedFailure

expectedCheckingFails = map ("examples" </>) ["nested-abstractors.brat"
,"karlheinz_alias.brat"
Expand Down
10 changes: 0 additions & 10 deletions brat/test/Test/Compile/Hugr.hs
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
module Test.Compile.Hugr where

import Brat.Checker (run)
import Brat.Checker.Monad (Checking)
import Brat.Checker.Types (TypedHole)
import Brat.Compiler (compileFile)
import Brat.Error (Error)
import Brat.Graph (Graph)
import Brat.Naming (root)
import Test.Checking (expectedCheckingFails)
import Test.Parsing (expectedParsingFails, expectFailForPaths)
import Test.Util (parseAndCheck)

import qualified Data.ByteString.Lazy as BS
import Data.List (partition)
import Data.Traversable (for)
import System.Directory (createDirectoryIfMissing)
import System.FilePath
import Test.Tasty
import Test.Tasty.HUnit
import Test.Tasty.Silver
import Test.Tasty.ExpectedFailure

prefix = "test/compilation"
examplesPrefix = "examples"
Expand Down
1 change: 0 additions & 1 deletion brat/test/Test/Elaboration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Brat.FC
import Data.Functor ((<&>))
import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.PartialOrd as PO
import qualified Data.Set as S
import Test.Tasty
import Test.Tasty.HUnit

Expand Down
1 change: 0 additions & 1 deletion brat/test/Test/Failure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module Test.Failure (getFailureTests) where
import Test.Tasty
import Test.Tasty.Silver
import System.Exit (ExitCode(..))
import Control.Monad (unless)
import Control.Exception
import System.FilePath
import System.IO
Expand Down
2 changes: 1 addition & 1 deletion brat/test/Test/Graph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Control.Monad.Except (runExceptT)
import Data.List (sortOn)
import Data.List.NonEmpty (NonEmpty(..))
import Data.Text (pack)
import System.FilePath ((<.>), FilePath, takeBaseName)
import System.FilePath ((<.>), takeBaseName)
import Test.Tasty
import Test.Tasty.HUnit (assertFailure)
import Test.Tasty.Silver
Expand Down
2 changes: 0 additions & 2 deletions brat/test/Test/Parsing.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
module Test.Parsing (getParsingTests, expectedParsingFails, expectFailForPaths) where

import Brat.Load
import Brat.Parser

import Control.Monad.Except
import System.FilePath
import Test.Tasty
import Test.Tasty.HUnit
Expand Down
6 changes: 0 additions & 6 deletions brat/test/Test/Search.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,18 @@
module Test.Search {- (searchTests) -} where

import Brat.Checker (check)
import Brat.Checker.Types (Modey(..))
import Brat.FC
import Brat.Naming
import Brat.Search (vsearch)
import Brat.Syntax.Common
import Brat.Syntax.Core
import Brat.Syntax.Simple (SimpleTerm(..))
import Hasochism (N(..))
import Util (names)
import Test.Util (runEmpty)

import Data.Either (isRight)
import Data.Functor ((<&>))
import Test.QuickCheck
import Test.Tasty.QuickCheck (testProperty)
import Test.Tasty
import Brat.Syntax.Value
import Bwd


-- Bounds for row lengths
Expand Down
8 changes: 4 additions & 4 deletions brat/test/Test/Substitution.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
module Test.Substitution where

import Test.Tasty

{-
-- TODO: update to value scopes syntax
import Brat.Checker.Monad
import Brat.Checker.Types
import Brat.Error
Expand All @@ -15,12 +19,8 @@ import Hasochism
import Test.Util (runEmpty)
import Data.Bifunctor
import Test.Tasty
import Test.Tasty.HUnit
{-
-- TODO: update to value scopes syntax
node = fst (fresh "" root)
-- Comparing type equality for rows is only exposed via checking equality of function types
Expand Down
3 changes: 0 additions & 3 deletions brat/test/Test/Syntax/Let.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module Test.Syntax.Let where
import Brat.Error (showError)
import Brat.Checker
import Brat.FC
import Brat.Load
import Brat.Naming
import Brat.Syntax.Common
import Brat.Syntax.Core
import Brat.Syntax.Simple
Expand All @@ -15,7 +13,6 @@ import Brat.UserName
import Test.Util (runEmpty)

import Data.String
import Test.Tasty
import Test.Tasty.HUnit

instance IsString UserName where
Expand Down
6 changes: 2 additions & 4 deletions brat/test/Test/TypeArith.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
module Test.TypeArith where

import Brat.Checker.Helpers (runArith)
import Brat.FC
import Brat.Naming (Name(..))
import Brat.Syntax.Common (ArithOp(..), TypeKind(Nat))
import Brat.Syntax.Common (ArithOp(..))
import Brat.Syntax.Port
import Brat.Syntax.Simple (SimpleTerm(..))
import Brat.Syntax.Value
import Hasochism (N(..), Ny(..), Some(..), (:*)(..))
import Hasochism (N(..))

import Data.List (sort)
import Test.Tasty
Expand Down
4 changes: 0 additions & 4 deletions brat/test/Test/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ import Brat.Error
import Brat.FC
import Brat.Load
import Brat.Naming
import Brat.Syntax.Common (CType'(..), TypeKind)
import Brat.Syntax.Port
import Brat.Syntax.Value
import Bwd

import Control.Monad.Except
import Test.Tasty
Expand Down

0 comments on commit 1d99dd2

Please sign in to comment.