Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve defer-failures #107

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{-# LANGUAGE TypeApplications #-}
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- | See @Test/Cat/ConCat/Main.hs@ for copious notes on the testing situation here.
module Main
Expand All @@ -29,7 +31,9 @@ import Data.Functor.Identity (Identity (..))
import Data.Proxy (Proxy (..))
import GHC.Int (Int64)
import GHC.Word (Word8)
import System.Exit (exitFailure, exitSuccess)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Main as Hedgehog (defaultMain)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}
Expand Down Expand Up @@ -84,4 +88,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ common hierarchy-tests
hs-source-dirs: test
ghc-options:
-fplugin Categorifier
-- -fplugin-opt Categorifier:defer-failures
-fplugin-opt Categorifier:defer-failures
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.Categories.hierarchy
build-depends:
, adjunctions ^>=4.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{-# LANGUAGE TypeApplications #-}
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- | See @Test/Cat/ConCat/Main.hs@ for copious notes on the testing situation here.
module Main
Expand All @@ -33,9 +35,11 @@ import Data.Proxy (Proxy (..))
import Data.Semigroup (Sum (..))
import GHC.Int (Int16, Int32, Int64, Int8)
import GHC.Word (Word16, Word32, Word64, Word8)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Main as Hedgehog (defaultMain)
import qualified Hedgehog.Range as Range
import System.Exit (exitFailure, exitSuccess)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}
Expand Down Expand Up @@ -1032,4 +1036,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ common hierarchy-tests
-- ensure unfoldings are available
-fno-omit-interface-pragmas
-fplugin Categorifier
-fplugin-opt Categorifier:defer-failures
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.ConCat.functionHierarchy
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.ConCatExtensions.hierarchy
build-depends:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

module Main
( main,
Expand All @@ -29,9 +31,11 @@ import Data.Proxy (Proxy (..))
import Data.Semigroup (Product (..), Sum (..))
import GHC.Int (Int16, Int32, Int64, Int8)
import GHC.Word (Word16, Word32, Word64, Word8)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Main as Hedgehog (defaultMain)
import qualified Hedgehog.Range as Range
import System.Exit (exitFailure, exitSuccess)

-- |
--
Expand Down Expand Up @@ -989,4 +993,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
8 changes: 6 additions & 2 deletions integrations/concat/integration-test/test/ConCat/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -Wno-redundant-constraints #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- |
-- Template Haskell is used to automate the generation of the same test cases for each category we
Expand Down Expand Up @@ -62,9 +64,11 @@ import Data.Proxy (Proxy (..))
import Data.Semigroup (Product (..), Sum (..))
import GHC.Int (Int16, Int32, Int64, Int8)
import GHC.Word (Word16, Word32, Word64, Word8)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Main as Hedgehog (defaultMain)
import qualified Hedgehog.Range as Range
import System.Exit (exitFailure, exitSuccess)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}
Expand Down Expand Up @@ -1569,4 +1573,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
21 changes: 11 additions & 10 deletions integrations/ghc-bignum/integration-test/test/GhcBignum/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{-# LANGUAGE TypeApplications #-}
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- | See @Test/Cat/ConCat/Main.hs@ for copious notes on the testing situation here.
module Main
Expand All @@ -26,25 +27,25 @@ import Categorifier.Test.Tests
( TestCases (..),
TestCategory (..),
TestStrategy (..),
builtinTestCategories,
mkTestTerms,
)
import Data.Bool (bool)
import Data.Proxy (Proxy (..))
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import System.Exit (exitFailure, exitSuccess)
import qualified Hedgehog.Main as Hedgehog (defaultMain)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}

mkTestTerms
GhcBignum.testTerms
-- name type prefix strategy
( [ TestCategory ''Term [t|Term|] "term" CheckCompileOnly,
TestCategory ''Hask [t|Hask|] "hask" $ ComputeFromInput [|runHask|]
]
<> builtinTestCategories
)
-- name type prefix strategy
[ TestCategory ''Term [t|Term|] "term" CheckCompileOnly,
TestCategory ''Hask [t|Hask|] "hask" $ ComputeFromInput [|runHask|],
TestCategory ''(->) [t|(->)|] "plainArrow" $ ComputeFromInput [|id|]
]
-- ghc-bignum
. HInsert1
(Proxy @"EqualInteger")
Expand Down Expand Up @@ -163,4 +164,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
20 changes: 11 additions & 9 deletions integrations/linear-base/integration-test/test/LinearBase/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
{-# OPTIONS_GHC -Wno-orphans #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- | See @Test/Cat/ConCat/Main.hs@ for copious notes on the testing situation here.
module Main
Expand All @@ -26,7 +28,6 @@ import Categorifier.Test.Tests
( TestCases (..),
TestCategory (..),
TestStrategy (..),
builtinTestCategories,
mkTestTerms,
)
import qualified Control.Functor.Linear
Expand All @@ -41,10 +42,12 @@ import qualified Data.V.Linear
import GHC.Int (Int64)
import GHC.TypeNats (KnownNat)
import GHC.Word (Word8)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Main as Hedgehog (defaultMain)
import qualified Hedgehog.Range as Range
import qualified Prelude.Linear
import System.Exit (exitFailure, exitSuccess)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}
Expand All @@ -57,12 +60,11 @@ instance (KnownNat n) => Pointed (Data.V.Linear.V n) where

mkTestTerms
LinearBase.testTerms
-- name type prefix strategy
( [ TestCategory ''Term [t|Term|] "term" CheckCompileOnly,
TestCategory ''Hask [t|Hask|] "hask" $ ComputeFromInput [|runHask|]
]
<> builtinTestCategories
)
-- name type prefix strategy
[ TestCategory ''Term [t|Term|] "term" CheckCompileOnly,
TestCategory ''Hask [t|Hask|] "hask" $ ComputeFromInput [|runHask|],
TestCategory ''(->) [t|(->)|] "plainArrow" $ ComputeFromInput [|id|]
]
-- linear-base
. HInsert1
(Proxy @"LinearAbs")
Expand Down Expand Up @@ -607,4 +609,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ common hierarchy-tests
-- ensure unfoldings are available
-fno-omit-interface-pragmas
-fplugin Categorifier
-fplugin-opt Categorifier:defer-failures
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.UnconCat.hierarchy
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.ConCat.functionHierarchy
build-depends:
Expand Down
8 changes: 6 additions & 2 deletions integrations/unconcat/integration-test/test/UnconCat/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE TypeApplications #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

module Main
( main,
Expand All @@ -27,9 +29,11 @@ import Data.Proxy (Proxy (..))
import Data.Semigroup (Sum (..))
import GHC.Int (Int16, Int32, Int64, Int8)
import GHC.Word (Word16, Word32, Word64, Word8)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Main as Hedgehog (defaultMain)
import qualified Hedgehog.Range as Range
import System.Exit (exitFailure, exitSuccess)

mkTestTerms
defaultTestTerms
Expand Down Expand Up @@ -814,4 +818,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ common hierarchy-tests
-- ensure unfoldings are available
-fno-omit-interface-pragmas
-fplugin Categorifier
-fplugin-opt Categorifier:defer-failures
-- Using the ConCat hierarchy, because it's the only one that supports `traverse` (and probably
-- other things)
-fplugin-opt Categorifier:hierarchy:Categorifier.Hierarchy.ConCat.functionHierarchy
Expand Down
8 changes: 6 additions & 2 deletions integrations/vec/integration-test/test/Vec/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
{-# LANGUAGE TypeApplications #-}
-- To avoid turning @if then else@ into `ifThenElse`.
{-# LANGUAGE NoRebindableSyntax #-}
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
{-# OPTIONS_GHC -Wno-unused-imports -Wno-unused-top-binds #-}

-- | See @Test/Cat/ConCat/Main.hs@ for copious notes on the testing situation here.
module Main
Expand All @@ -31,7 +33,9 @@ import qualified Data.Type.Nat as Nat
import Data.Vec.Lazy (Vec (..))
import qualified Data.Vec.Lazy as Vec
import GHC.Word (Word8)
import System.Exit (exitFailure, exitSuccess)
-- To allow testing of individual properties (see plugin/README.md#dealing_with_failed_tests)
import qualified Hedgehog
import qualified Hedgehog.Main as Hedgehog (defaultMain)

-- For @NoRebindableSyntax@
{-# ANN module ("HLint: ignore Avoid restricted integration" :: String) #-}
Expand Down Expand Up @@ -101,4 +105,4 @@ mkTestTerms
$ HEmpty1

main :: IO ()
main = bool exitFailure exitSuccess . and =<< allTestTerms
main = Hedgehog.defaultMain allTestTerms
Loading
Loading