Rain: added tests for parsing process calls
This commit is contained in:
parent
bf2ea2feac
commit
54ba4c3315
|
@ -464,6 +464,22 @@ testComm =
|
|||
,fail ("c ? x ? y;",RP.statement)
|
||||
,fail ("c ? x , y;",RP.statement)
|
||||
]
|
||||
|
||||
testRun :: [ParseTest A.Process]
|
||||
testRun =
|
||||
[
|
||||
pass ("run foo();",RP.statement,assertPatternMatch "testRun 1" $ tag3 A.ProcCall DontCare (procNamePattern "foo") ([] :: [A.Actual]))
|
||||
,pass ("run foo(c);",RP.statement,assertPatternMatch "testRun 2" $ tag3 A.ProcCall DontCare (procNamePattern "foo")
|
||||
[tag3 A.ActualVariable A.Original A.Any (variablePattern "c")])
|
||||
,pass ("run foo(c,0+x);",RP.statement,assertPatternMatch "testRun 3" $ tag3 A.ProcCall DontCare (procNamePattern "foo")
|
||||
[tag3 A.ActualVariable A.Original A.Any (variablePattern "c"),tag2 A.ActualExpression A.Any $ tag4 A.Dyadic DontCare A.Plus (intLiteralPattern 0) (exprVariablePattern "x")])
|
||||
,fail ("run",RP.statement)
|
||||
,fail ("run;",RP.statement)
|
||||
,fail ("run ();",RP.statement)
|
||||
,fail ("run foo()",RP.statement)
|
||||
,fail ("run foo(,);",RP.statement)
|
||||
|
||||
]
|
||||
|
||||
--Returns the list of tests:
|
||||
tests :: Test
|
||||
|
@ -480,6 +496,7 @@ tests = TestList
|
|||
parseTests testAssign,
|
||||
parseTests testDataType,
|
||||
parseTests testComm,
|
||||
parseTests testRun,
|
||||
parseTests testDecl,
|
||||
parseTests testTopLevelDecl
|
||||
]
|
||||
|
|
|
@ -61,6 +61,9 @@ variablePattern e = tag2 A.Variable DontCare (simpleNamePattern e)
|
|||
exprVariable :: String -> A.Expression
|
||||
exprVariable e = A.ExprVariable m $ variable e
|
||||
|
||||
exprVariablePattern :: String -> Pattern
|
||||
exprVariablePattern e = tag2 A.ExprVariable DontCare $ variablePattern e
|
||||
|
||||
intLiteral :: Integer -> A.Expression
|
||||
intLiteral n = A.Literal m A.Int $ A.IntLiteral m (show n)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user