File: Main.hs

package info (click to toggle)
haskell-cborg-json 0.2.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 88 kB
  • sloc: haskell: 188; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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")
        ]
    ]