-
Notifications
You must be signed in to change notification settings - Fork 86
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 #315 from well-typed/yaitskov-support-bytestring-i…
…n-json-as-hex Support bytestring in json as Base64Url
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
|
||
module Main (main) where | ||
|
||
import Codec.CBOR.JSON | ||
import Codec.CBOR.Read | ||
import Data.Aeson (Value (String)) | ||
import qualified Data.ByteString.Base16 as HEX | ||
import Data.ByteString.Lazy (fromStrict) | ||
import Test.Tasty (TestTree, defaultMain, testGroup) | ||
import Test.Tasty.HUnit (testCase, (@=?)) | ||
|
||
|
||
main :: IO () | ||
main = do | ||
defaultMain tests | ||
|
||
|
||
tests :: TestTree | ||
tests = | ||
testGroup "CBOR-JSON" | ||
[ testGroup "unit tests" | ||
[ testCase "decode variable ByteString as Base62Url String" $ | ||
Right ("", String "MDEy") @=? deserialiseFromBytes (decodeValue True) | ||
(fromStrict . either error id $ HEX.decode "5803303132") | ||
] | ||
] |