@@ -1,5 +1,5 @@
11--Test Atomable typeclass which allows users to use existing Haskell datatypes to marshal them to and from the database as ConstructedAtoms.
2−{-# LANGUAGE DeriveGeneric, DeriveAnyClass, OverloadedStrings #-}
2+{-# LANGUAGE DeriveGeneric, DeriveAnyClass, OverloadedStrings, TypeApplications #-}
33import Test.HUnit
44import ProjectM36.Client
55import Data.Binary
@@ -75,7 +75,7 @@ main = do
7575 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
7676
7777testList :: Test
78−testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either, testNonPrimitiveValues, testRecordType, testManyFields]
78+testList = TestList [testHaskell2DB, testADT1, testADT2, testADT3, testADT4, testADT5, testBasicMarshaling, testSimpleList, testListInstance, testNonEmptyInstance, testADT6Maybe, testADT7Either, testNonPrimitiveValues, testRecordType, testManyFields]
7979
8080-- test some basic data types like int, day, etc.
8181testBasicMarshaling :: Test
@@ -160,6 +160,12 @@ testListInstance = TestCase $ do
160160 let example = TestListC [3,4,5]
161161 assertEqual "List instance" example (fromAtom (toAtom example))
162162
163+testSimpleList :: Test
164+testSimpleList = TestCase $ do
165+ let example = toAtom @[Integer] [1,2,3]
166+ expected = ConstructedAtom "Cons" (ConstructedAtomType "List" (M.fromList [("a",IntegerAtomType)])) [IntegerAtom 1,ConstructedAtom "Cons" (ConstructedAtomType "List" (M.fromList [("a",IntegerAtomType)])) [IntegerAtom 2,ConstructedAtom "Cons" (ConstructedAtomType "List" (M.fromList [("a",IntegerAtomType)])) [IntegerAtom 3,ConstructedAtom "Empty" (ConstructedAtomType "List" (M.fromList [("a",IntegerAtomType)])) []]]]
167+ assertEqual "simple list" expected example
168+
163169testNonEmptyInstance :: Test
164170testNonEmptyInstance = TestCase $ do
165171 let example = TestNonEmptyC [3,4,5]