Merge interface tests into literate tests
parent
9a9b67d410
commit
5631e2500f
|
@ -138,12 +138,3 @@ test-suite littests
|
||||||
, parsec ^>= 3.1.14
|
, parsec ^>= 3.1.14
|
||||||
main-is: Main.hs
|
main-is: Main.hs
|
||||||
hs-source-dirs: src-literatetests
|
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
|
|
||||||
|
|
|
@ -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
|
|
|
@ -32,6 +32,9 @@ import System.Timeout ( timeout )
|
||||||
|
|
||||||
import Language.Haskell.Brittany.Internal.PreludeUtils
|
import Language.Haskell.Brittany.Internal.PreludeUtils
|
||||||
|
|
||||||
|
hush :: Either a b -> Maybe b
|
||||||
|
hush = either (const Nothing) Just
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
asymptoticPerfTest :: Spec
|
asymptoticPerfTest :: Spec
|
||||||
|
@ -92,6 +95,21 @@ main = do
|
||||||
let groupsCtxFree = createChunks inputCtxFree
|
let groupsCtxFree = createChunks inputCtxFree
|
||||||
hspec $ do
|
hspec $ do
|
||||||
describe "asymptotic perf roundtrips" $ asymptoticPerfTest
|
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
|
groups `forM_` \(groupname, tests) -> do
|
||||||
describe (Text.unpack groupname) $ do
|
describe (Text.unpack groupname) $ do
|
||||||
tests `forM_` \test -> do
|
tests `forM_` \test -> do
|
||||||
|
|
Loading…
Reference in New Issue