THRIFT-3482 Haskell JSON protocol does not encode binary field as Base64
diff --git a/lib/hs/test/CompactSpec.hs b/lib/hs/test/CompactSpec.hs
index 22708b4..5540e7b 100644
--- a/lib/hs/test/CompactSpec.hs
+++ b/lib/hs/test/CompactSpec.hs
@@ -56,3 +56,26 @@
writeVal proto $ TDouble val
val2 <- readVal proto T_DOUBLE
val2 `shouldBe` (TDouble val)
+
+ describe "binary" $ do
+ it "writes" $ do
+ trans <- openMemoryBuffer
+ let proto = CompactProtocol trans
+ writeVal proto (TBinary $ LBS.pack [42, 43, 44])
+ bin <- tRead trans 100
+ (LBS.unpack bin) `shouldBe` [3, 42, 43, 44]
+
+ it "reads" $ do
+ trans <- openMemoryBuffer
+ let proto = CompactProtocol trans
+ tWrite trans $ LBS.pack [3, 42, 43, 44]
+ val <- readVal proto (T_BINARY)
+ val `shouldBe` (TBinary $ LBS.pack [42, 43, 44])
+
+ prop "round trip" $ \val -> do
+ trans <- openMemoryBuffer
+ let proto = CompactProtocol trans
+ writeVal proto (TBinary $ LBS.pack val)
+ val2 <- readVal proto (T_BINARY)
+ val2 `shouldBe` (TBinary $ LBS.pack val)
+