Skip to content

Commit ff8f2db

Browse files
committed
"url":"pull/5633", "account":"haskell", "repo":"cabal", "commit": "c81bc98faecd922da640455f99c10008ff3fb191", "tag":"linux-7.6.3" }
0 parents  commit ff8f2db

File tree

271 files changed

+24653
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+24653
-0
lines changed

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
language: c
2+
dist: trusty
3+
# This doesn't actually help because we always push a single
4+
# commit to the branch in question
5+
#git:
6+
# # https://github.com/travis-ci/travis-ci/issues/4575
7+
# depth: 1
8+
sudo: required
9+
before_install:
10+
- export PATH=/opt/ghc/$GHCVER/bin:$PATH
11+
- export PATH=$HOME/.ghc-install/$GHCVER/bin:$PATH
12+
- export PATH=$HOME/bin:$PATH
13+
- export PATH=$HOME/.cabal/bin:$PATH
14+
- export PATH=$HOME/.local/bin:$PATH
15+
- export PATH=/opt/cabal/2.0/bin:$PATH
16+
- export PATH=/opt/happy/1.19.5/bin:$PATH
17+
- export PATH=/opt/alex/3.1.7/bin:$PATH
18+
- ./travis-install.sh
19+
script:
20+
- ./travis-test.sh
21+
after_success:
22+
- ./travis-cleanup.sh
23+
notifications:
24+
webhooks:
25+
urls: https://sake-bot.herokuapp.com/
26+
on_start: always
27+
irc:
28+
channels:
29+
- "chat.freenode.net##haskell-cabal"
30+
slack: haskell-cabal:sCq6GLfy9N8MJrInosg871n4
31+
# To append on:
32+
# env: GHCVER=7.6.3 UPSTREAM_BUILD_DIR=/home/travis/user/repo
33+
# os: linux
34+
env: GHCVER=7.6.3 UPSTREAM_BUILD_DIR=/home/travis/build/haskell/cabal CABAL_LIB_ONLY=YES TEST_OTHER_VERSIONS=YES
35+
os: linux

Cabal/tests/CheckTests.hs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
module Main
2+
( main
3+
) where
4+
5+
import Test.Tasty
6+
import Test.Tasty.Golden.Advanced (goldenTest)
7+
8+
import Data.Algorithm.Diff (Diff (..), getGroupedDiff)
9+
import Distribution.PackageDescription.Check (checkPackage)
10+
import Distribution.PackageDescription.Parsec (parseGenericPackageDescription)
11+
import Distribution.Parsec.Common (showPError, showPWarning)
12+
import Distribution.Parsec.ParseResult (runParseResult)
13+
import Distribution.Utils.Generic (fromUTF8BS, toUTF8BS)
14+
import System.FilePath (replaceExtension, (</>))
15+
16+
import qualified Data.ByteString as BS
17+
import qualified Data.ByteString.Char8 as BS8
18+
19+
tests :: TestTree
20+
tests = checkTests
21+
22+
-------------------------------------------------------------------------------
23+
-- Regressions
24+
-------------------------------------------------------------------------------
25+
26+
checkTests :: TestTree
27+
checkTests = testGroup "regressions"
28+
[ checkTest "nothing-unicode.cabal"
29+
, checkTest "haddock-api-2.18.1-check.cabal"
30+
, checkTest "issue-774.cabal"
31+
, checkTest "MiniAgda.cabal"
32+
, checkTest "extensions-paths-5054.cabal"
33+
, checkTest "pre-1.6-glob.cabal"
34+
, checkTest "pre-2.4-globstar.cabal"
35+
, checkTest "bad-glob-syntax.cabal"
36+
, checkTest "cc-options-with-optimization.cabal"
37+
, checkTest "cxx-options-with-optimization.cabal"
38+
, checkTest "ghc-option-j.cabal"
39+
]
40+
41+
checkTest :: FilePath -> TestTree
42+
checkTest fp = cabalGoldenTest fp correct $ do
43+
contents <- BS.readFile input
44+
let res = parseGenericPackageDescription contents
45+
let (ws, x) = runParseResult res
46+
47+
return $ toUTF8BS $ case x of
48+
Right gpd ->
49+
-- Note: parser warnings are reported by `cabal check`, but not by
50+
-- D.PD.Check functionality.
51+
unlines (map (showPWarning fp) ws) ++
52+
unlines (map show (checkPackage gpd Nothing))
53+
Left (_, errs) -> unlines $ map (("ERROR: " ++) . showPError fp) errs
54+
where
55+
input = "tests" </> "ParserTests" </> "regressions" </> fp
56+
correct = replaceExtension input "check"
57+
58+
-------------------------------------------------------------------------------
59+
-- Main
60+
-------------------------------------------------------------------------------
61+
62+
main :: IO ()
63+
main = defaultMain tests
64+
65+
cabalGoldenTest :: TestName -> FilePath -> IO BS.ByteString -> TestTree
66+
cabalGoldenTest name ref act = goldenTest name (BS.readFile ref) act cmp upd
67+
where
68+
upd = BS.writeFile ref
69+
cmp x y | x == y = return Nothing
70+
cmp x y = return $ Just $ unlines $
71+
concatMap f (getGroupedDiff (BS8.lines x) (BS8.lines y))
72+
where
73+
f (First xs) = map (cons3 '-' . fromUTF8BS) xs
74+
f (Second ys) = map (cons3 '+' . fromUTF8BS) ys
75+
-- we print unchanged lines too. It shouldn't be a problem while we have
76+
-- reasonably small examples
77+
f (Both xs _) = map (cons3 ' ' . fromUTF8BS) xs
78+
-- we add three characters, so the changed lines are easier to spot
79+
cons3 c cs = c : c : c : ' ' : cs

0 commit comments

Comments
 (0)