From 52d72647aee7183798ffcb9198e5562926ed1af0 Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Thu, 20 Mar 2008 11:23:45 +0000 Subject: [PATCH] Fix the transformConstr0 test by defining x. --- transformations/PassTest.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/transformations/PassTest.hs b/transformations/PassTest.hs index 6c5f668..8c7b612 100644 --- a/transformations/PassTest.hs +++ b/transformations/PassTest.hs @@ -19,7 +19,7 @@ with this program. If not, see . -- | Contains test for various shared passes. module PassTest (tests) where -import Control.Monad.Identity +import Control.Monad.State import Data.Generics import qualified Data.Map as Map import Test.HUnit hiding (State) @@ -33,7 +33,6 @@ import SimplifyExprs import TagAST import TestUtils import TreeUtils -import Types import Utils m :: Meta @@ -203,8 +202,11 @@ skipP = A.Only m (A.Skip m) -- | Tests that a simple constructor (with no expression, nor function call) gets converted into the appropriate initialisation code testTransformConstr0 :: Test -testTransformConstr0 = TestCase $ testPass "transformConstr0" exp (transformConstr orig) (return ()) +testTransformConstr0 = TestCase $ testPass "transformConstr0" exp (transformConstr orig) startState where + startState :: State CompState () + startState = defineConst "x" A.Int (intLiteral 42) + orig = A.Spec m (A.Specification m (simpleName "arr") $ A.IsExpr m A.ValAbbrev (A.Array [dimension 10] A.Int) $ A.ExprConstr m $ A.RepConstr m (A.For m (simpleName "x") (intLiteral 0) (intLiteral 10)) (exprVariable "x") ) skipP