mirror of
https://github.com/idris-lang/Idris2.git
synced 2025-01-02 16:48:30 +03:00
Merge pull request #2254 from dunhamsteve/tcbug_test
[ tests ] Add test case for #2243
This commit is contained in:
commit
8e55c32694
@ -284,6 +284,7 @@ nodeTests = MkTestPool "Node backend" [] (Just Node)
|
||||
, "stringcast"
|
||||
, "syntax001"
|
||||
, "tailrec001"
|
||||
, "tailrec002"
|
||||
, "idiom001"
|
||||
, "integers"
|
||||
, "fix1839"
|
||||
|
13
tests/node/tailrec002/EvenOdd.idr
Normal file
13
tests/node/tailrec002/EvenOdd.idr
Normal 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)
|
17
tests/node/tailrec002/Main.idr
Normal file
17
tests/node/tailrec002/Main.idr
Normal 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
|
1
tests/node/tailrec002/expected
Normal file
1
tests/node/tailrec002/expected
Normal file
@ -0,0 +1 @@
|
||||
[]
|
4
tests/node/tailrec002/run
Executable file
4
tests/node/tailrec002/run
Executable 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
|
||||
|
Loading…
Reference in New Issue
Block a user