diff --git a/brittany.cabal b/brittany.cabal index d659a6a..3589ed9 100644 --- a/brittany.cabal +++ b/brittany.cabal @@ -138,12 +138,3 @@ test-suite littests , parsec ^>= 3.1.14 main-is: Main.hs hs-source-dirs: src-literatetests - -test-suite libinterfacetests - import: executable - - type: exitcode-stdio-1.0 - build-depends: - , hspec ^>= 2.8.3 - main-is: Main.hs - hs-source-dirs: src-libinterfacetests diff --git a/src-libinterfacetests/Main.hs b/src-libinterfacetests/Main.hs deleted file mode 100644 index 2d1924f..0000000 --- a/src-libinterfacetests/Main.hs +++ /dev/null @@ -1,27 +0,0 @@ -import Test.Hspec -import Language.Haskell.Brittany -import qualified Data.Text as Text -import Control.Monad.IO.Class - - - -main :: IO () -main = hspec $ do - describe "library interface basic functionality" $ do - it "gives properly formatted result for valid input" $ do - let - input = Text.pack $ unlines - ["func = [00000000000000000000000, 00000000000000000000000, 00000000000000000000000, 00000000000000000000000]"] - let expected = Text.pack $ unlines - [ "func =" - , " [ 00000000000000000000000" - , " , 00000000000000000000000" - , " , 00000000000000000000000" - , " , 00000000000000000000000" - , " ]" - ] - output <- liftIO $ parsePrintModule staticDefaultConfig input - hush output `shouldBe` Just expected - -hush :: Either a b -> Maybe b -hush = either (const Nothing) Just diff --git a/src-literatetests/Main.hs b/src-literatetests/Main.hs index e97252d..dbc2ee5 100644 --- a/src-literatetests/Main.hs +++ b/src-literatetests/Main.hs @@ -32,6 +32,9 @@ import System.Timeout ( timeout ) import Language.Haskell.Brittany.Internal.PreludeUtils +hush :: Either a b -> Maybe b +hush = either (const Nothing) Just + asymptoticPerfTest :: Spec @@ -92,6 +95,21 @@ main = do let groupsCtxFree = createChunks inputCtxFree hspec $ do describe "asymptotic perf roundtrips" $ asymptoticPerfTest + describe "library interface basic functionality" $ do + it "gives properly formatted result for valid input" $ do + let + input = Text.pack $ unlines + ["func = [00000000000000000000000, 00000000000000000000000, 00000000000000000000000, 00000000000000000000000]"] + let expected = Text.pack $ unlines + [ "func =" + , " [ 00000000000000000000000" + , " , 00000000000000000000000" + , " , 00000000000000000000000" + , " , 00000000000000000000000" + , " ]" + ] + output <- liftIO $ parsePrintModule staticDefaultConfig input + hush output `shouldBe` Just expected groups `forM_` \(groupname, tests) -> do describe (Text.unpack groupname) $ do tests `forM_` \test -> do