Skip to content

Commit

Permalink
dev-haskell/saltine: loosen profunctors dep
Browse files Browse the repository at this point in the history
...and also fix tests. It seems the release tarball was missing a test
module, the patch added came directly from the project git history.

[An issue][1] has been opened to loosen the profunctors dep.

[1]: tel/saltine#57

Signed-off-by: Wolfgang E. Sanyer <[email protected]>
  • Loading branch information
ezzieyguywuf committed Jan 12, 2021
1 parent 1d25239 commit 7f3a5d8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/tests/HashProperties.hs b/tests/HashProperties.hs
new file mode 100644
index 0000000..3f37fb4
--- /dev/null
+++ b/tests/HashProperties.hs
@@ -0,0 +1,37 @@
+{-# LANGUAGE OverloadedStrings #-}
+
+module HashProperties (
+ testHash
+ ) where
+
+import Util
+import Crypto.Saltine.Core.Hash
+
+import qualified Data.ByteString as S
+import Test.Framework.Providers.QuickCheck2
+import Test.Framework
+import Test.QuickCheck
+
+testHash :: Test
+testHash = buildTest $ do
+ shKey <- newShorthashKey
+ shKey2 <- newShorthashKey
+
+ return $ testGroup "...Internal.Hash" [
+
+ testProperty "No two hashes are alike"
+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> hash bs1 /= hash bs2,
+
+ testProperty "Hash of empty ByteString is correct"
+ $ \(Message bs) -> (bs == S.empty) ==> hash bs == (read hashEmptyBS :: S.ByteString),
+
+ testProperty "No two shorthashes are alike"
+ $ \(Message bs1, Message bs2) -> bs1 /= bs2 ==> shorthash shKey bs1 /= shorthash shKey bs2,
+
+ testProperty "Different keys produce different shorthashes"
+ $ \(Message bs) -> shorthash shKey bs /= shorthash shKey2 bs
+
+ ]
+
+ where
+ hashEmptyBS = "\"\207\131\225\&5~\239\184\189\241T(P\214m\128\a\214 \228\ENQ\vW\NAK\220\131\244\169!\211l\233\206G\208\209<]\133\242\176\255\131\CAN\210\135~\236/c\185\&1\189GAz\129\165\&82z\249'\218>\""
23 changes: 16 additions & 7 deletions dev-haskell/saltine/saltine-0.1.1.0.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EAPI=7

# ebuild generated by hackport 0.6.5.9999

CABAL_FEATURES="lib profile haddock hoogle hscolour" # test-suite"
CABAL_FEATURES="lib profile haddock hoogle hscolour test-suite"
inherit haskell-cabal

DESCRIPTION="Cryptography that's easy to digest (NaCl/libsodium bindings)"
Expand All @@ -17,17 +17,26 @@ SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86"
IUSE=""

RESTRICT=test # test suite fails to build
PATCHES="${FILESDIR}/${PN}-0.1.1.0-missing-test-module.patch"

RDEPEND="dev-haskell/hashable:=[profile?]
>=dev-haskell/profunctors-5.3:=[profile?] <dev-haskell/profunctors-5.6:=[profile?]
>=dev-haskell/profunctors-5.3:=[profile?]
>=dev-lang/ghc-8.0.1:=
>=dev-libs/libsodium-1.0.13
"

DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.24.0.0
virtual/pkgconfig
" # test? ( dev-haskell/quickcheck
# dev-haskell/semigroups
# dev-haskell/test-framework
# dev-haskell/test-framework-quickcheck2 )
test? ( dev-haskell/quickcheck
dev-haskell/semigroups
dev-haskell/test-framework
dev-haskell/test-framework-quickcheck2 )
"

src_prepare() {
default

cabal_chdeps \
'profunctors >= 5.3 && < 5.6' 'profunctors >= 5.3'
}

0 comments on commit 7f3a5d8

Please sign in to comment.