diff --git a/test/Diffing/Algorithm/RWS/Spec.hs b/test/Diffing/Algorithm/RWS/Spec.hs index 5a74597e9..aaf93710a 100644 --- a/test/Diffing/Algorithm/RWS/Spec.hs +++ b/test/Diffing/Algorithm/RWS/Spec.hs @@ -12,8 +12,8 @@ import Data.Term import Data.These import Diffing.Algorithm import Diffing.Algorithm.RWS -import Test.Hspec import Test.Hspec.LeanCheck +import SpecHelpers spec :: Spec spec = parallel $ do diff --git a/test/Diffing/Interpreter/Spec.hs b/test/Diffing/Interpreter/Spec.hs index 75cb107dc..d1e2d5700 100644 --- a/test/Diffing/Interpreter/Spec.hs +++ b/test/Diffing/Interpreter/Spec.hs @@ -14,6 +14,7 @@ import Test.Hspec (Spec, describe, it, parallel) import Test.Hspec.Expectations.Pretty import Test.Hspec.LeanCheck import Test.LeanCheck.Core +import SpecHelpers spec :: Spec spec = parallel $ do diff --git a/test/SpecHelpers.hs b/test/SpecHelpers.hs index b4823e846..c156b6326 100644 --- a/test/SpecHelpers.hs +++ b/test/SpecHelpers.hs @@ -1,3 +1,5 @@ +{-# OPTIONS_GHC -fno-warn-orphans #-} + module SpecHelpers ( module X , runBuilder @@ -41,6 +43,7 @@ import Data.Record as X import Data.Semilattice.Lower as X import Data.Source as X import Data.Span as X +import Data.String import Data.Sum import Data.Term as X import Parsing.Parser as X @@ -68,6 +71,11 @@ import qualified Semantic.IO as IO runBuilder = toStrict . toLazyByteString +-- | This orphan instance is so we don't have to insert @name@ calls +-- in dozens and dozens of environment specs. +instance IsString Name where + fromString = name . fromString + -- | Returns an s-expression formatted diff for the specified FilePath pair. diffFilePaths :: Both FilePath -> IO ByteString diffFilePaths paths = readFilePair paths >>= fmap runBuilder . runTask . runDiff SExpressionDiffRenderer . pure