-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6255 from commercialhaskell/re6250-hpc
Re #6250 Output summary reports to stdout, not stderr
- Loading branch information
Showing
6 changed files
with
53 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 12 additions & 11 deletions
23
tests/integration/tests/4105-test-coverage-of-internal-lib/Main.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
import Control.Monad (unless) | ||
import Data.List (isInfixOf, isPrefixOf) | ||
import Control.Monad ( unless ) | ||
import Data.List ( isInfixOf, isPrefixOf ) | ||
import StackTest | ||
|
||
main :: IO () | ||
main = do | ||
stack ["clean"] | ||
stack ["build"] | ||
res <- getCoverageLines . snd <$> stackStderr ["test", "--coverage", "--color", "never"] | ||
case res of | ||
_:exprs:_ -> unless ("2/2" `isInfixOf` exprs) testFail | ||
_ -> testFail | ||
where | ||
testFail = fail "Stack didn't generate coverage from both libraries" | ||
stackCheckStdout ["test", "--coverage", "--color", "never"] check | ||
|
||
check :: String -> IO () | ||
check output = case getCoverageLines output of | ||
_:exprs:_ -> unless ("2/2" `isInfixOf` exprs) testFail | ||
_ -> testFail | ||
where | ||
testFail = fail "Stack didn't generate coverage from both libraries" | ||
|
||
getCoverageLines :: String -> [String] | ||
getCoverageLines = dropWhile (not . isCoverageHeader) . lines | ||
where | ||
isCoverageHeader = isPrefixOf "Generating coverage report for " | ||
where | ||
isCoverageHeader = isPrefixOf "Summary coverage report for " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters