Changed some tests to use the new mSeq matching helpers
This commit is contained in:
parent
5ab259074a
commit
4c20f99ac3
|
@ -41,6 +41,7 @@ import Errors
|
||||||
import Pattern
|
import Pattern
|
||||||
import RainPasses
|
import RainPasses
|
||||||
import RainTypes
|
import RainTypes
|
||||||
|
import TagAST
|
||||||
import TestUtil
|
import TestUtil
|
||||||
import TreeUtil
|
import TreeUtil
|
||||||
|
|
||||||
|
@ -66,19 +67,19 @@ testEachPass0 = TestCase $ testPassWithItemsStateCheck "testEachPass0" exp (tran
|
||||||
(A.ForEach m (simpleName "c") (makeLiteralStringRain "1"))
|
(A.ForEach m (simpleName "c") (makeLiteralStringRain "1"))
|
||||||
(A.OnlyP m (makeAssign (variable "c") (intLiteral 7)))
|
(A.OnlyP m (makeAssign (variable "c") (intLiteral 7)))
|
||||||
)
|
)
|
||||||
exp = tag2 A.Seq DontCare
|
exp = mSeq
|
||||||
(tag3 A.Spec DontCare
|
(mSpec
|
||||||
(tag3 A.Specification DontCare listVarName
|
(mSpecification listVarName
|
||||||
(tag4 A.IsExpr DontCare A.ValAbbrev (A.List A.Byte) (makeLiteralStringRain "1"))
|
(mIsExpr A.ValAbbrev (A.List A.Byte) (makeLiteralStringRain "1"))
|
||||||
)
|
)
|
||||||
(tag3 A.Rep DontCare
|
(mRep
|
||||||
(tag4 A.For DontCare indexVar (intLiteral 0) (tag2 A.SizeVariable DontCare listVar))
|
(mFor indexVar (intLiteral 0) (tag2 A.SizeVariable DontCare listVar))
|
||||||
(tag3 A.Spec DontCare
|
(mSpec
|
||||||
(tag3 A.Specification DontCare (simpleName "c")
|
(mSpecification (simpleName "c")
|
||||||
--ValAbbrev because we are abbreviating an expression:
|
--ValAbbrev because we are abbreviating an expression:
|
||||||
(tag4 A.Is DontCare A.ValAbbrev A.Byte
|
(mIs A.ValAbbrev A.Byte
|
||||||
(tag3 A.SubscriptedVariable DontCare
|
(mSubscriptedVariable
|
||||||
(tag2 A.Subscript DontCare (tag2 A.ExprVariable DontCare (tag2 A.Variable DontCare indexVar)))
|
(mSubscript (mExprVariable (mVariable indexVar)))
|
||||||
listVar
|
listVar
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -89,7 +90,7 @@ testEachPass0 = TestCase $ testPassWithItemsStateCheck "testEachPass0" exp (tran
|
||||||
)
|
)
|
||||||
indexVar = Named "indexVar" DontCare
|
indexVar = Named "indexVar" DontCare
|
||||||
listVarName = Named "listVarName" DontCare
|
listVarName = Named "listVarName" DontCare
|
||||||
listVar = tag2 A.Variable DontCare listVarName
|
listVar = mVariable listVarName
|
||||||
|
|
||||||
--Need to also check the names were recorded properly in CompState, so that later passes will work properly:
|
--Need to also check the names were recorded properly in CompState, so that later passes will work properly:
|
||||||
check :: (Items,CompState) -> Assertion
|
check :: (Items,CompState) -> Assertion
|
||||||
|
|
|
@ -30,6 +30,7 @@ import Errors
|
||||||
import Pass
|
import Pass
|
||||||
import Pattern
|
import Pattern
|
||||||
import RainTypes
|
import RainTypes
|
||||||
|
import TagAST
|
||||||
import TestUtil
|
import TestUtil
|
||||||
import TreeUtil
|
import TreeUtil
|
||||||
import Types
|
import Types
|
||||||
|
@ -286,11 +287,11 @@ checkExpressionTest = TestList
|
||||||
passWhileIf n exp src = TestList
|
passWhileIf n exp src = TestList
|
||||||
[
|
[
|
||||||
TestCase $ testPass ("checkExpressionTest/if " ++ show n)
|
TestCase $ testPass ("checkExpressionTest/if " ++ show n)
|
||||||
(tag2 A.If DontCare $ tag2 A.OnlyC DontCare $ tag3 A.Choice DontCare (buildExprPattern exp) (tag1 A.Skip DontCare))
|
(mIf $ tag2 A.OnlyC DontCare $ tag3 A.Choice DontCare (buildExprPattern exp) (tag1 A.Skip DontCare))
|
||||||
(checkConditionalTypes $ A.If m $ A.OnlyC m $ A.Choice m (buildExpr src) (A.Skip m))
|
(checkConditionalTypes $ A.If m $ A.OnlyC m $ A.Choice m (buildExpr src) (A.Skip m))
|
||||||
state
|
state
|
||||||
,TestCase $ testPass ("checkExpressionTest/while " ++ show n)
|
,TestCase $ testPass ("checkExpressionTest/while " ++ show n)
|
||||||
(tag3 A.While DontCare (buildExprPattern exp) (tag1 A.Skip DontCare))
|
(mWhile (buildExprPattern exp) (tag1 A.Skip DontCare))
|
||||||
(checkConditionalTypes $ A.While m (buildExpr src) (A.Skip m))
|
(checkConditionalTypes $ A.While m (buildExpr src) (A.Skip m))
|
||||||
state
|
state
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user