Skip to content

Commit

Permalink
remove more things + weeder
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed May 8, 2019
1 parent 7af5371 commit 31d0c2e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 233 deletions.
10 changes: 10 additions & 0 deletions .weeder.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,13 @@
- name: Module not compiled
- module: Cardano.Launcher.Windows

- package:
- name: cardano-wallet-jormungandr
- section:
- name: test:unit
- message:
- name: Weeds exported
- module:
- name: Spec
- identifier: main

28 changes: 7 additions & 21 deletions lib/jormungandr/cardano-wallet-jormungandr.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ library
build-depends:
base
, cardano-wallet-core
, binary
, bytestring
, cardano-crypto
, cryptonite
, digest
, memory
, fmt
-- , binary
-- , bytestring
-- , cardano-crypto
-- , cryptonite
-- , digest
, text
, text-class
hs-source-dirs:
Expand All @@ -49,8 +49,6 @@ library
Cardano.Wallet.Binary.Jormungandr
Cardano.Wallet.Compatibility.Jormungandr
Cardano.Wallet.Transaction.Jormungandr
Data.Packfile
Servant.Extra.ContentTypes

test-suite unit
default-language:
Expand All @@ -67,23 +65,11 @@ test-suite unit
-Werror
build-depends:
base
, aeson
, base58-bytestring
, bytestring
, cardano-crypto
, cardano-wallet-core
, cardano-wallet-jormungandr
, cborg
, containers
, digest
, fmt
, generic-arbitrary
, hspec
, hspec-golden-aeson
, memory
, QuickCheck
, text-class
, transformers
, hspec
type:
exitcode-stdio-1.0
hs-source-dirs:
Expand Down
2 changes: 0 additions & 2 deletions lib/jormungandr/src/Cardano/Wallet/Binary/Jormungandr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@
module Cardano.Wallet.Binary.Jormungandr
(
) where


93 changes: 0 additions & 93 deletions lib/jormungandr/src/Data/Packfile.hs

This file was deleted.

98 changes: 0 additions & 98 deletions lib/jormungandr/src/Servant/Extra/ContentTypes.hs

This file was deleted.

Binary file not shown.
24 changes: 5 additions & 19 deletions lib/jormungandr/test/unit/Cardano/Wallet/Binary/JormungandrSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

module Cardano.Wallet.Binary.JormungandrSpec
( spec

-- * Helpers
, unsafeDeserialiseFromBytes
) where

import Prelude

import Cardano.Wallet.Binary.Jormungandr
()
import Data.ByteString
( ByteString )

import Cardano.Wallet.Primitive.Types
( BlockHeader (..), Hash (..), SlotId (..) )
Expand All @@ -22,13 +21,6 @@ import Data.ByteArray.Encoding
import Test.Hspec
( Spec, describe, shouldBe, xit )

import qualified Codec.CBOR.Decoding as CBOR
--import qualified Codec.CBOR.Encoding as CBOR
import qualified Codec.CBOR.Read as CBOR
--import qualified Codec.CBOR.Write as CBOR
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BL

{-# ANN spec ("HLint: ignore Use head" :: String) #-}
spec :: Spec
spec = do
Expand All @@ -38,11 +30,11 @@ spec = do
`shouldBe`
BlockHeader (SlotId 0 0) (Hash "?")
where
unsafeDeserialiseFromBytes = undefined
decodeGenesisBlock = error "TODO: import from Binary.Jormungandr"

genesisBlock :: BL.ByteString
genesisBlock =
either error BL.fromStrict $ convertFromBase @BS.ByteString Base16
genesisBlock :: ByteString
genesisBlock = either error id $ convertFromBase @ByteString Base16
"005200000000009f000000000000000000000000ffadebfecd59d9eaa12e903a\
\d58100f7c1e35899739c3d05d022835c069d2b4f000000000000000000000000\
\00000000000000000000000000000000000000000047000048000000005cc1c2\
Expand All @@ -51,9 +43,3 @@ genesisBlock =
\0001000000ff0005000006000000000000000000000000000000000000000000\
\0000000000002c020001833324c37869c122689a35917df53a4f2294a3a52f68\
\5e05f5f8e53b87e7ea452f000000000000000e"

-- | CBOR deserialise without error handling - handy for prototypes or testing.
unsafeDeserialiseFromBytes :: (forall s. CBOR.Decoder s a) -> BL.ByteString -> a
unsafeDeserialiseFromBytes decoder bytes =
either (\e -> error $ "unsafeDeserialiseFromBytes: " <> show e) snd $
CBOR.deserialiseFromBytes decoder bytes

0 comments on commit 31d0c2e

Please sign in to comment.