-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 changed file
with
23 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
-- | | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Pact.Core.Test.LegacySerialiseTests where | ||
|
||
import Test.Tasty (TestTree, testGroup) | ||
import Test.Tasty.HUnit (assertBool, testCase) | ||
import Data.Maybe | ||
import Pact.Core.Serialise.LegacyPact | ||
import Pact.Core.Guards | ||
import Data.Text (Text) | ||
import qualified Data.Text.IO as T | ||
|
||
tests :: TestTree | ||
tests = testGroup "Legacy Serialisation" | ||
[ testGroup "KeySet" | ||
[ testCase "pred: keys-2" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-2\",\"keys\":[\"ddd8\",\"ed0\"]}")) | ||
, testCase "pred: keys-all" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-all\",\"keys\":[\"ddd8\",\"ed0\"]}")) | ||
, testCase "pred: keys-any" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-any\",\"keys\":[\"ddd8\",\"ed0\"]}")) | ||
, testCase "pred defaults" $ assertBool "KeySet decoding failed" (maybe False (\k -> KeysAll == _ksPredFun k) (decodeKeySet "{\"pred\":\"keys-all\",\"keys\":[\"ddd8\",\"ed0\"]}")) | ||
, testCase "pred invalid" $ assertBool "Accept invalid pred" (isNothing (decodeKeySet "{\"pred\":\"ABC\",\"keys\":[\"ddd8\",\"ed0\"]}")) | ||
] | ||
] |