Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
cirrus-ci_task:
container:
image: toxchat/toktok-stack:0.0.23-third_party
image: toxchat/toktok-stack:0.0.27-third_party
cpu: 2
memory: 6G
configure_script:
Expand Down
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
packages: [.]
resolver: lts-14.27
resolver: lts-18.18
extra-deps:
- msgpack-types-0.0.4
62 changes: 9 additions & 53 deletions test/Data/MessagePackSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import qualified Data.Text.Lazy as LT
import qualified Data.Vector as V
import qualified Data.Vector.Storable as VS
import qualified Data.Vector.Unboxed as VU
import Data.Void (Void)
import Data.Word (Word, Word16, Word32, Word64,
Word8)
import GHC.Generics (Generic)
Expand Down Expand Up @@ -61,10 +60,9 @@ data Foo
| Foo4 Int
| Foo5 Int
| Foo6 { unFoo3 :: Int }
| Foo7 (Maybe Foo)
| Foo8 Int
| Foo9 Int Int
| Foo10 Int Int Int
| Foo7 Int
| Foo8 Int Int
| Foo9 Int Int Int
deriving (Eq, Show, Generic)

instance MessagePack Foo
Expand All @@ -78,9 +76,8 @@ instance Arbitrary Foo where
, Foo5 <$> arbitrary
, Foo6 <$> arbitrary
, Foo7 <$> arbitrary
, Foo8 <$> arbitrary
, Foo9 <$> arbitrary <*> arbitrary
, Foo10 <$> arbitrary <*> arbitrary <*> arbitrary
, Foo8 <$> arbitrary <*> arbitrary
, Foo9 <$> arbitrary <*> arbitrary <*> arbitrary
]


Expand Down Expand Up @@ -285,8 +282,6 @@ spec = do
property $ \(a :: L.ByteString) -> a `shouldBe` mid a
it "lazy-text" $
property $ \(a :: LT.Text) -> a `shouldBe` mid a
it "maybe int" $
property $ \(a :: (Maybe Int)) -> a `shouldBe` mid a
it "[int]" $
property $ \(a :: [Int]) -> a `shouldBe` mid a
it "vector int" $
Expand Down Expand Up @@ -325,42 +320,6 @@ spec = do
property $ \(a :: IntMap.IntMap Int) -> a `shouldBe` mid a
it "HashMap String Int" $
property $ \(a :: HashMap.HashMap String Int) -> a `shouldBe` mid a
it "maybe int" $
property $ \(a :: Maybe Int) -> a `shouldBe` mid a
it "maybe nil" $
property $ \(a :: Maybe ()) -> a `shouldBe` mid a
it "maybe maybe int" $
property $ \(a :: Maybe (Maybe Int)) -> a `shouldBe` mid a
it "maybe bool" $
property $ \(a :: Maybe Bool) -> a `shouldBe` mid a
it "maybe double" $
property $ \(a :: Maybe Double) -> a `shouldBe` mid a
it "maybe string" $
property $ \(a :: Maybe String) -> a `shouldBe` mid a
it "maybe bytestring" $
property $ \(a :: Maybe S.ByteString) -> a `shouldBe` mid a
it "maybe lazy-bytestring" $
property $ \(a :: Maybe L.ByteString) -> a `shouldBe` mid a
it "maybe [int]" $
property $ \(a :: Maybe [Int]) -> a `shouldBe` mid a
it "maybe [string]" $
property $ \(a :: Maybe [String]) -> a `shouldBe` mid a
it "maybe (int, int)" $
property $ \(a :: Maybe (Int, Int)) -> a `shouldBe` mid a
it "maybe (int, int, int)" $
property $ \(a :: Maybe (Int, Int, Int)) -> a `shouldBe` mid a
it "maybe (int, int, int, int)" $
property $ \(a :: Maybe (Int, Int, Int, Int)) -> a `shouldBe` mid a
it "maybe (int, int, int, int, int)" $
property $ \(a :: Maybe (Int, Int, Int, Int, Int)) -> a `shouldBe` mid a
it "maybe [(int, double)]" $
property $ \(a :: Maybe [(Int, Double)]) -> a `shouldBe` mid a
it "maybe [(string, string)]" $
property $ \(a :: Maybe [(String, String)]) -> a `shouldBe` mid a
it "maybe (Assoc [(string, int)])" $
property $ \(a :: Maybe (Assoc [(String, Int)])) -> a `shouldBe` mid a
it "either int float" $
property $ \(a :: Either Int Float) -> a `shouldBe` mid a

it "generics" $
property $ \(a :: Foo) -> a `shouldBe` mid a
Expand All @@ -379,16 +338,13 @@ spec = do
show (toObject Foo1) `shouldBe` "ObjectWord 0"
show (toObject $ Foo3 3) `shouldBe` "ObjectArray [ObjectWord 2,ObjectWord 3]"
show (toObject $ Foo3 (-3)) `shouldBe` "ObjectArray [ObjectWord 2,ObjectInt (-3)]"
show (toObject $ Foo9 3 5) `shouldBe` "ObjectArray [ObjectWord 8,ObjectArray [ObjectWord 3,ObjectWord 5]]"
show (toObject $ Foo9 (-3) (-5)) `shouldBe` "ObjectArray [ObjectWord 8,ObjectArray [ObjectInt (-3),ObjectInt (-5)]]"
show (toObject $ Foo10 3 5 7) `shouldBe` "ObjectArray [ObjectWord 9,ObjectArray [ObjectWord 3,ObjectWord 5,ObjectWord 7]]"
show (toObject $ Foo10 (-3) (-5) 7) `shouldBe` "ObjectArray [ObjectWord 9,ObjectArray [ObjectInt (-3),ObjectInt (-5),ObjectWord 7]]"
show (toObject $ Foo8 3 5) `shouldBe` "ObjectArray [ObjectWord 7,ObjectArray [ObjectWord 3,ObjectWord 5]]"
show (toObject $ Foo8 (-3) (-5)) `shouldBe` "ObjectArray [ObjectWord 7,ObjectArray [ObjectInt (-3),ObjectInt (-5)]]"
show (toObject $ Foo9 3 5 7) `shouldBe` "ObjectArray [ObjectWord 8,ObjectArray [ObjectWord 3,ObjectWord 5,ObjectWord 7]]"
show (toObject $ Foo9 (-3) (-5) 7) `shouldBe` "ObjectArray [ObjectWord 8,ObjectArray [ObjectInt (-3),ObjectInt (-5),ObjectWord 7]]"

it "TyConArgs" $
show (toObject $ TyConArgs 3 5 7) `shouldBe` "ObjectArray [ObjectWord 3,ObjectWord 5,ObjectWord 7]"

it "Record" $
show (toObject $ Record 3 5 "7") `shouldBe` "ObjectArray [ObjectWord 3,ObjectDouble 5.0,ObjectStr \"7\"]"

voidTest :: Void -> Object
voidTest = toObject