-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #161 from input-output-hk/jonathanknowles/text-ins…
…tances Add roundtrip textual encoding tests for `Network` and `Port` CLI types.
- Loading branch information
Showing
4 changed files
with
50 additions
and
5 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
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,37 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleInstances #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# OPTIONS_GHC -fno-warn-orphans #-} | ||
|
||
module Cardano.CLISpec | ||
(spec | ||
) where | ||
|
||
import Prelude | ||
|
||
import Cardano.CLI | ||
( Network, Port ) | ||
import Data.Proxy | ||
( Proxy (..) ) | ||
import Test.Hspec | ||
( Spec, describe ) | ||
import Test.QuickCheck | ||
( Arbitrary (..) ) | ||
import Test.QuickCheck.Arbitrary.Generic | ||
( genericArbitrary, genericShrink ) | ||
import Test.Text.Roundtrip | ||
( textRoundtrip ) | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "Can perform roundtrip textual encoding & decoding" $ do | ||
textRoundtrip $ Proxy @Network | ||
textRoundtrip $ Proxy @(Port "test") | ||
|
||
instance Arbitrary Network where | ||
arbitrary = genericArbitrary | ||
shrink = genericShrink | ||
|
||
instance Arbitrary (Port "test") where | ||
arbitrary = genericArbitrary | ||
shrink = genericShrink |