Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
259 additions
and
28 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
dist/ | ||
dist/ | ||
cabal-dev/ |
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
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
import Control.Monad (when) | ||
|
||
import qualified Distribution.Package as Cabal | ||
|
||
import qualified Portage.Dependency as Portage | ||
|
||
import System.Exit (exitFailure) | ||
import Test.HUnit | ||
|
||
tests = TestList [ TestLabel "simple merge" test_merge1 | ||
] | ||
|
||
test_merge1 = map (\(a,b,c) -> assertEqual "excepting merge" c (a `Portage.mergeDeps` b)) cases | ||
where | ||
cases = | ||
[ (["foo/bar"],["foo/baz"],["foo/bar", "foo/baz"]) -- a /= b => a+b | ||
--, (["foo/bar","foo/baz"],["foo/baz"],["foo/bar","foo/baz"]) -- a == b => a | ||
--, (["foo/bar"],["use? (foo/baz)"],["foo/bar", "use? (foo/baz)"]) -- covered by 1st | ||
--, (["foo/bar"],["use? (foo/bar)"],["foo/bar"]) -- a <> (use? a) => a | ||
--, (["foo/bar"],["use? ( use2? (foo/bar))"],["foo/bar"]) | ||
-- , ([!use("foo/bar")],["use? (foo/baz)"],["!use? (foo/bar)","use? (foo/baz)"]) -- extract dep | ||
] | ||
|
||
-- A <> B | ||
-- rules: | ||
-- 1). \forall b \in B: \exists a \in A a ~= b -> {A <> B \ b} | ||
-- 2). \forall b \in B: \not \exists a \in A ~=b | ||
|
||
something_broke :: Counts -> Bool | ||
something_broke stats = errors stats + failures stats > 0 | ||
|
||
main = | ||
do stats <- runTestTT tests | ||
when (something_broke stats) exitFailure |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module Main | ||
|
||
import Control.Monad (when) | ||
|
||
import qualified Distribution.Package as Cabal | ||
|
||
import qualified Portage.Overlay as Portage | ||
import qualified Portage.Resolve as Portage | ||
import qualified Portage.PackageId as Portage | ||
import qualified Portage.Host as Portage | ||
|
||
import System.Exit (exitFailure) | ||
import Test.HUnit | ||
|
||
tests = TestList [ TestLabel "resolve cabal" (test_resolveCategory "dev-haskell" "cabal") | ||
, TestLabel "resolve ghc" (test_resolveCategory "dev-lang" "ghc") | ||
, TestLabel "resolve Cabal" (test_resolveCategory "dev-haskell" "Cabal") | ||
, TestLabel "resolve DaRsC" (test_resolveCategory "dev-vcs" "darcs") | ||
] | ||
|
||
uses = [ ("use", UseFlag "use") | ||
, ("use?", Q (UseFlag "use")) | ||
, ("!use", X (UseFlag "use"))] | ||
test_resolveCategory :: String -> String -> Test | ||
test_resolveCategory cat pkg = TestCase $ do | ||
portage_dir <- Portage.portage_dir `fmap` Portage.getInfo | ||
portage <- Portage.loadLazy portage_dir | ||
let cabal = Cabal.PackageName pkg | ||
hits = Portage.resolveFullPortageName portage cabal | ||
expected = Just (Portage.PackageName (Portage.Category cat) (Portage.normalizeCabalPackageName cabal)) | ||
assertEqual ("expecting to find package " ++ pkg) expected hits | ||
|
||
something_broke :: Counts -> Bool | ||
something_broke stats = errors stats + failures stats > 0 | ||
|
||
main = | ||
do stats <- runTestTT tests | ||
when (something_broke stats) exitFailure |