packages feed

spdx 1 → 1.0.0.1

raw patch · 3 files changed

+70/−57 lines, 3 filesdep ~Cabaldep ~QuickCheckdep ~base

Dependency ranges changed: Cabal, QuickCheck, base, tasty

Files

spdx.cabal view
@@ -1,78 +1,76 @@-cabal-version:       2.2-name:                spdx-version:             1--synopsis:            SPDX license expression language, Extras-category:            Data-description:         Cabal provides SPDX types. This package provides some extras.+cabal-version:      2.2+name:               spdx+version:            1.0.0.1+synopsis:           SPDX license expression language, Extras+category:           Data+description:+  Cabal provides SPDX types. This package provides some extras. -homepage:            https://github.com/phadej/spdx-license:             BSD-3-Clause-license-file:        LICENSE-author:              Oleg Grenrus <oleg.grenrus@iki.fi>-maintainer:          Oleg Grenrus <oleg.grenrus@iki.fi>-copyright:           (c) 2015-2018 Oleg Grenrus-build-type:          Simple+homepage:           https://github.com/phadej/spdx+license:            BSD-3-Clause+license-file:       LICENSE+author:             Oleg Grenrus <oleg.grenrus@iki.fi>+maintainer:         Oleg Grenrus <oleg.grenrus@iki.fi>+copyright:          (c) 2015-2018 Oleg Grenrus+build-type:         Simple+extra-source-files:+  README.md+  CHANGELOG.md -extra-source-files:  README.md CHANGELOG.md tested-with:-  GHC ==7.6.3-   || ==7.8.4-   || ==7.10.3-   || ==8.0.2-   || ==8.2.2-   || ==8.4.4-   || ==8.6.1+  GHC ==7.6.3 || ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.1  source-repository head-  type: git+  type:     git   location: https://github.com/phadej/spdx  library-  default-language:    Haskell98+  default-language: Haskell98   exposed-modules:     Distribution.SPDX.Extra     Distribution.SPDX.Extra.Internal+   other-extensions:     CPP-    DeriveFunctor,-    DeriveFoldable,-    DeriveTraversable,     DeriveDataTypeable-  hs-source-dirs:      src/-  ghc-options:         -Wall+    DeriveFoldable+    DeriveFunctor+    DeriveTraversable++  hs-source-dirs:   src/+  ghc-options:      -Wall   build-depends:-    , base              >=4.3.0.0 && <4.13-    , Cabal             >=2.4.0.1 && <2.5-    , containers        >=0.5.0.0 && <0.7-    , transformers      >=0.3     && <0.6+    , base          >=4.3.0.0 && <4.14+    , Cabal         ^>=2.4.0.1 || ^>=3.0.0.0+    , containers    >=0.5.0.0 && <0.7+    , transformers  >=0.3     && <0.6  test-suite test-  type:                exitcode-stdio-1.0-  main-is:             Tests.hs-  other-modules:       Generators-  default-language:    Haskell98-  hs-source-dirs:      tests-  ghc-options:         -Wall+  type:             exitcode-stdio-1.0+  main-is:          Tests.hs+  other-modules:    Generators+  default-language: Haskell98+  hs-source-dirs:   tests+  ghc-options:      -Wall   build-depends:     , base     , base-compat       ^>=0.10.5     , Cabal     , spdx-    , tasty             ^>=1.1.0.4+    , tasty             >=1.1.0.4 && <1.3     , tasty-quickcheck  ^>=0.10  benchmark bench-  type:                exitcode-stdio-1.0-  main-is:             Bench.hs-  other-modules:       Generators-  default-language:    Haskell98-  hs-source-dirs:      tests bench-  ghc-options:         -Wall+  type:             exitcode-stdio-1.0+  main-is:          Bench.hs+  other-modules:    Generators+  default-language: Haskell98+  hs-source-dirs:   tests bench+  ghc-options:      -Wall   build-depends:     , base     , base-compat       ^>=0.10.5     , Cabal+    , QuickCheck        >=2.12.6.1 && <2.14     , spdx-    , QuickCheck       ^>=2.12.6.1-    , tasty-quickcheck ^>=0.10+    , tasty-quickcheck  ^>=0.10
tests/Generators.hs view
@@ -14,11 +14,18 @@ import           Distribution.SPDX import           Distribution.SPDX.Extra.Internal (LatticeSyntax(..)) +latestLicenseListVersion :: LicenseListVersion+#if MIN_VERSION_Cabal(3,0,0)+latestLicenseListVersion = LicenseListVersion_3_6+#else+latestLicenseListVersion = LicenseListVersion_3_2+#endif+ licenseIdGen :: Gen LicenseId-licenseIdGen = elements $ licenseIdList LicenseListVersion_3_2+licenseIdGen = elements $ licenseIdList latestLicenseListVersion  licenseExceptionGen :: Gen LicenseExceptionId-licenseExceptionGen = elements $ licenseExceptionIdList LicenseListVersion_3_2+licenseExceptionGen = elements $ licenseExceptionIdList latestLicenseListVersion  licenseRefGen :: Gen LicenseRef licenseRefGen = mkLicenseRef' <$> liftArbitrary idStringGen <*> idStringGen
tests/Tests.hs view
@@ -1,7 +1,7 @@+{-# LANGUAGE CPP #-} module Main (main) where  import Data.Maybe                       (isJust)-import Distribution.Parsec.Class import Distribution.Pretty import Distribution.SPDX import Distribution.SPDX.Extra@@ -12,6 +12,12 @@ import Test.Tasty import Test.Tasty.QuickCheck            as QC +#if MIN_VERSION_Cabal(3,0,0)+import Distribution.Parsec+#else+import Distribution.Parsec.Class+#endif+ import qualified Distribution.SPDX.Extra.Internal as LS  main :: IO ()@@ -42,9 +48,11 @@   -- | Like `equivalent`, but prints a counterexample when it fails.-equivalentProp :: Maybe License -> Maybe License -> Property-equivalentProp x y = counterexample (show x ++ " /= " ++ show y) $-    length x == length y && (and $ equivalent <$> x <*> y)+equivalentProp :: Either String License -> Maybe License -> Property+equivalentProp (Left _)  Nothing  = property True+equivalentProp (Left e)  (Just y) = counterexample (e ++ " /      = " ++ show y) $ False+equivalentProp (Right x) Nothing  = counterexample (show x ++ " / = <nothing>") $ False+equivalentProp (Right x) (Just y) = counterexample (show x ++ " /= " ++ show y) $ equivalent x y  simpleUnits :: TestTree simpleUnits = testGroup "Simple License Expressions"@@ -86,11 +94,11 @@  parsePrettyProps :: TestTree parsePrettyProps = testGroup "parse . pretty"-  [ QC.testProperty "LicenseId" $ forAll licenseIdGen $ \i -> mkLicenseId LicenseListVersion_3_2 (prettyShow i) === Just i+  [ QC.testProperty "LicenseId" $ forAll licenseIdGen $ \i -> mkLicenseId latestLicenseListVersion (prettyShow i) === Just i   , QC.testProperty "LicenseExpression"  $ forAllShrink (scaleGen (`div` 3) exprGen)  exprShrink $ \e ->       let p = prettyShow e-      in counterexample p $ simpleParsec p `equivalentProp` Just e+      in counterexample p $ eitherParsec p `equivalentProp` Just e   , QC.testProperty "LicenseExpression'" $ forAllShrink (scaleGen (`div` 3) exprGen') exprShrink $ \e ->       let p = prettyShow e-      in counterexample p $ simpleParsec p `equivalentProp` Just e+      in counterexample p $ eitherParsec p `equivalentProp` Just e   ]