Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raehik committed Feb 1, 2022
1 parent ef54b58 commit a240060
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/Language/Fortran/Parser/FreeFormCommon.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,19 @@ specFreeFormCommon sParser eParser =
dims = AList () u
[ DimensionDeclarator () u Nothing (Just (intGen 2)) ]
sParser stStr `shouldBe'` expected

describe "Function call" $ do
it "parses a simple function call" $ do
let stStr = "call double(i, i)"
expected = StCall () u (varGen "double") (Just args)
args = AList () u [arg, arg]
arg = Argument () u Nothing (ArgExpr (varGen "i"))
sParser stStr `shouldBe'` expected

it "parses a parenthesized variable as a special indirect/copied variable reference" $ do
let stStr = "call double((i), i)"
expected = StCall () u (varGen "double") (Just args)
args = AList () u [ genArg (ArgExprVar () u "i")
, genArg (ArgExpr (varGen "i")) ]
genArg = Argument () u Nothing
sParser stStr `shouldBe'` expected

0 comments on commit a240060

Please sign in to comment.