Merge pull request #2254 from dunhamsteve/tcbug_test

[ tests ] Add test case for #2243
This commit is contained in:
Zoe Stafford 2022-01-08 20:51:52 +00:00 committed by GitHub
commit 8e55c32694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 0 deletions

View File

@ -284,6 +284,7 @@ nodeTests = MkTestPool "Node backend" [] (Just Node)
, "stringcast"
, "syntax001"
, "tailrec001"
, "tailrec002"
, "idiom001"
, "integers"
, "fix1839"

View File

@ -0,0 +1,13 @@
module Main
mutual
is_even : Nat -> Bool
is_even Z = True
is_even (S k) = is_odd k
is_odd : Nat -> Bool
is_odd Z = False
is_odd (S k) = is_even k
main : IO ()
main = printLn (is_even 10)

View File

@ -0,0 +1,17 @@
module Main
import System.File
import Data.String
import Data.List1
import Data.List
parse : String -> Maybe String
parse x = case forget $ split (\c => c == ' ' || c == '(') x of
"function" :: name :: _ => Just name
_ => Nothing
main : IO ()
main = do
Right res <- readFile "build/exec/app.js" | Left err => printLn err
let fns = mapMaybe parse $ lines res
printLn $ fns \\ nub fns

View File

@ -0,0 +1 @@
[]

4
tests/node/tailrec002/run Executable file
View File

@ -0,0 +1,4 @@
$1 --no-color --console-width 0 --no-banner --cg node EvenOdd.idr -o app.js
$1 --no-color --console-width 0 --no-banner Main.idr -x main
rm -rf build