diff options
Diffstat (limited to 'test/TestUtils.hs')
| -rw-r--r-- | test/TestUtils.hs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/test/TestUtils.hs b/test/TestUtils.hs index 1f0d386..f023bb7 100644 --- a/test/TestUtils.hs +++ b/test/TestUtils.hs @@ -27,29 +27,41 @@ expectSuccessL :: Env -> LContext a -> IO (a, LState) expectSuccessL env lc = do res <- testRunL env lc case res of - Left (LException _ err) -> error $ "unexpected error: " ++ err + Left ex -> error $ "unexpected error: " ++ (foldStackMessage ex) Right val -> return val expectErrorL :: Show a => Env -> LContext a -> IO String expectErrorL env lc = do res <- testRunL env lc case res of - Left (LException _ err) -> return err + Left ex -> return $ foldStackMessage ex Right (val, _) -> error $ "unexpected success: " ++ show val makeEnv :: [(String, AST)] -> Env makeEnv = M.fromList . map (B.second Regular) ast :: ASTNode -> AST -ast node = AST { an = node } +ast node = makeNonsenseAST node +astInteger :: Integer -> AST astInteger a = ast $ ASTInteger a +astDouble :: Double -> AST astDouble a = ast $ ASTDouble a +astSymbol :: String -> AST astSymbol a = ast $ ASTSymbol a +astBoolean :: Bool -> AST astBoolean a = ast $ ASTBoolean a +astString :: String -> AST astString a = ast $ ASTString a +astTag :: String -> AST +astTag a = ast $ ASTTag (computeTagN a) a +astVector :: [AST] -> AST astVector a = ast $ ASTVector a +astFunctionCall :: [AST] -> AST astFunctionCall a = ast $ ASTFunctionCall a +astHashMap :: M.Map AST AST -> AST astHashMap a = ast $ ASTHashMap a +astUnit :: AST astUnit = ast $ ASTUnit +astHole :: AST astHole = ast $ ASTHole |
