File tree Expand file tree Collapse file tree 3 files changed +27
-23
lines changed
test/Test/Codec/CBOR/Cuddle/CDDL Expand file tree Collapse file tree 3 files changed +27
-23
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ import Codec.CBOR.FlatTerm (toFlatTerm)
14
14
import Codec.CBOR.Pretty (prettyHexEnc )
15
15
import Codec.CBOR.Term (encodeTerm )
16
16
import Codec.CBOR.Write (toStrictByteString )
17
+ import Data.ByteString.Base16 qualified as Base16
18
+ import Data.ByteString.Char8 qualified as BSC
17
19
import Data.Text qualified as T
18
20
import Data.Text.IO qualified as T
19
21
import Options.Applicative
@@ -153,7 +155,7 @@ run (Opts cmd cddlFile) = do
153
155
in case outputFormat x of
154
156
AsTerm -> print term
155
157
AsFlatTerm -> print $ toFlatTerm (encodeTerm term)
156
- AsCBOR -> print . toStrictByteString $ encodeTerm term
158
+ AsCBOR -> BSC. putStrLn . Base16. encode . toStrictByteString $ encodeTerm term
157
159
AsPrettyCBOR -> putStrLn . prettyHexEnc $ encodeTerm term
158
160
159
161
putStrLnErr :: String -> IO ()
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ library
47
47
Codec.CBOR.Cuddle.CDDL
48
48
Codec.CBOR.Cuddle.CDDL.CtlOp
49
49
Codec.CBOR.Cuddle.CDDL.CTree
50
- Codec.CBOR.Cuddle.CDDL.Prelude
51
50
Codec.CBOR.Cuddle.CDDL.Postlude
51
+ Codec.CBOR.Cuddle.CDDL.Prelude
52
52
Codec.CBOR.Cuddle.CDDL.Resolve
53
53
Codec.CBOR.Cuddle.Huddle
54
54
Codec.CBOR.Cuddle.Huddle.HuddleM
@@ -109,6 +109,8 @@ executable cuddle
109
109
main-is : Main.hs
110
110
build-depends :
111
111
, base >= 4.14.0.0
112
+ , base16-bytestring
113
+ , bytestring
112
114
, cborg
113
115
, cuddle
114
116
, megaparsec
@@ -121,9 +123,9 @@ test-suite cuddle-test
121
123
import : warnings, ghc2021
122
124
default-language : Haskell2010
123
125
other-modules :
126
+ Test.Codec.CBOR.Cuddle.CDDL.Examples
124
127
Test.Codec.CBOR.Cuddle.CDDL.Gen
125
128
Test.Codec.CBOR.Cuddle.CDDL.Parser
126
- Test.Codec.CBOR.Cuddle.CDDL.Examples
127
129
Test.Codec.CBOR.Cuddle.Huddle
128
130
129
131
-- other-extensions:
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import Codec.CBOR.Cuddle.CDDL.CtlOp qualified as CtlOp
7
7
import Codec.CBOR.Cuddle.Parser
8
8
import Codec.CBOR.Cuddle.Parser.Lexer (Parser )
9
9
import Codec.CBOR.Cuddle.Pretty ()
10
- import Data.List.NonEmpty (NonEmpty (.. ))
10
+ import Data.List.NonEmpty (NonEmpty (.. ))
11
11
import Data.Text qualified as T
12
12
import Prettyprinter (Pretty , defaultLayoutOptions , layoutPretty , pretty )
13
13
import Prettyprinter.Render.Text (renderStrict )
@@ -230,19 +230,19 @@ type2Spec = describe "type2" $ do
230
230
)
231
231
]
232
232
:| [
233
- [ noComment $
234
- GEType
235
- Nothing
236
- Nothing
237
- ( Type0
238
- ( Type1
239
- (T2Name (Name " string" ) Nothing )
240
- Nothing
241
- :| []
242
- )
233
+ [ noComment $
234
+ GEType
235
+ Nothing
236
+ Nothing
237
+ ( Type0
238
+ ( Type1
239
+ (T2Name (Name " string" ) Nothing )
240
+ Nothing
241
+ :| []
243
242
)
244
- ]
245
- ]
243
+ )
244
+ ]
245
+ ]
246
246
)
247
247
)
248
248
@@ -257,13 +257,13 @@ type2Spec = describe "type2" $ do
257
257
(Type0 ((:| [] ) (Type1 (T2Value (VUInt 0 )) Nothing )))
258
258
]
259
259
:| [
260
- [ noComment $
261
- GEType
262
- Nothing
263
- Nothing
264
- (Type0 ((:| [] ) (Type1 (T2Value (VUInt 1 )) Nothing )))
265
- ]
266
- ]
260
+ [ noComment $
261
+ GEType
262
+ Nothing
263
+ Nothing
264
+ (Type0 ((:| [] ) (Type1 (T2Value (VUInt 1 )) Nothing )))
265
+ ]
266
+ ]
267
267
)
268
268
)
269
269
it " Trailing commas permitted" $
You can’t perform that action at this time.
0 commit comments