Skip to content
This repository was archived by the owner on Jan 2, 2021. It is now read-only.

Expect bench experiments to fail with Cabal #704

Merged
merged 1 commit into from
Jul 20, 2020
Merged
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
1 change: 1 addition & 0 deletions stack-ghc-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ flags:
ghc-options:
ghc-lib-parser: -O0
ghc-lib: -O0
ghcide: -DSTACK
3 changes: 3 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ extra-deps:
- extra-1.7.2
nix:
packages: [zlib]

ghc-options:
ghcide: -DSTACK
3 changes: 3 additions & 0 deletions stack810.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ extra-deps:

nix:
packages: [zlib]

ghc-options:
ghcide: -DSTACK
4 changes: 4 additions & 0 deletions stack84.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ extra-deps:

nix:
packages: [zlib]


ghc-options:
ghcide: -DSTACK
3 changes: 3 additions & 0 deletions stack88.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ extra-deps:
- extra-1.7.2
nix:
packages: [zlib]

ghc-options:
ghcide: -DSTACK
13 changes: 11 additions & 2 deletions test/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ addTypeAnnotationsToLiteralsTest = testGroup "add type annotations to literals t
, ""
, "import Debug.Trace"
, ""
, "f a = traceShow \"debug\" a"
, "f a = traceShow \"debug\" a"
])
[ (DsWarning, (6, 6), "Defaulting the following constraint") ]
"Add type annotation ‘[Char]’ to ‘\"debug\"’"
Expand Down Expand Up @@ -2303,6 +2303,13 @@ xfail8101 = flip expectFailBecause
xfail8101 t _ = t
#endif

expectFailCabal :: String -> TestTree -> TestTree
#ifdef STACK
expectFailCabal _ = id
#else
expectFailCabal = expectFailBecause
#endif

data Expect
= ExpectRange Range -- Both gotoDef and hover should report this range
| ExpectLocation Location
Expand Down Expand Up @@ -2678,17 +2685,19 @@ nonLspCommandLine = testGroup "ghcide command line"
]

benchmarkTests :: TestTree
-- These tests require stack and will fail with cabal test
benchmarkTests =
let ?config = Bench.defConfig
{ Bench.verbosity = Bench.Quiet
, Bench.repetitions = Just 3
, Bench.buildTool = Bench.Stack
} in
withResource Bench.setup id $ \_ -> testGroup "benchmark experiments"
[ testCase (Bench.name e) $ do
[ expectFailCabal "Requires stack" $ testCase (Bench.name e) $ do
res <- Bench.runBench runInDir e
assertBool "did not successfully complete 5 repetitions" $ Bench.success res
| e <- Bench.experiments
, Bench.name e /= "edit" -- the edit experiment does not ever fail
]

----------------------------------------------------------------------
Expand Down