on fbfa2ea help sign in
21 lines 793 B history raw
1import Test.HUnit
2import ProjectM36.Base
3import TutorialD.Interpreter.Import.TutorialD
4import System.Exit
5import System.IO.Temp
6import qualified Data.Map as M
7import System.IO
9main :: IO ()
10main = do
11 tcounts <- runTestTT $ TestList [testTutdImport]
12 if errors tcounts + failures tcounts > 0 then exitFailure else exitSuccess
14testTutdImport :: Test
15testTutdImport = TestCase $
16 withSystemTempFile "m.tutd" $ \tempPath handle -> do
17 hPutStrLn handle "x:=relation{tuple{a 5,b \"spam\"}}"
18 hClose handle
19 let expectedExpr = MultipleExpr [Assign "x" (MakeRelationFromExprs Nothing [TupleExpr (M.fromList [("a",NakedAtomExpr $ IntAtom 5),("b",NakedAtomExpr $ TextAtom "spam")])])]
20 imported <- importTutorialD tempPath
21 assertEqual "import tutd" (Right expectedExpr) imported