mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-26 13:11:30 +03:00
1619206d24
Missed a case which is covered now by checking for exceptions where postOptions is used add *> <* to Core
41 lines
1.1 KiB
Idris
41 lines
1.1 KiB
Idris
module Specifiers
|
|
|
|
{- This tests both the given specifiers and the error reporting of them.
|
|
To this end it tests via:
|
|
-o foo -- testing cli compilation
|
|
--exec main -- testing cli execution
|
|
|
|
> :exec main -- testing repl execution
|
|
|
|
> :set eval exec -- testing repl evaluation with eval set to execute
|
|
> main
|
|
-}
|
|
|
|
-- Generic match good for any scheme backend
|
|
%foreign "scheme:+"
|
|
plusGeneric : Int -> Int -> Int
|
|
|
|
-- We're testing with --cg chez so this specifier should be chosen.
|
|
%foreign "scheme,chez:+"
|
|
plusChez : Int -> Int -> Int
|
|
|
|
-- We're testing with --cg chez so this should match C because chez accepts C
|
|
-- specifiers but the next test should fail.
|
|
%foreign "scheme,racket:+"
|
|
"C:notreal,notalib"
|
|
plusRacketOK : Int -> Int -> Int
|
|
|
|
-- We're testing with --cg chez so this shouldn't find a valid specifier to use.
|
|
%foreign "scheme,racket:+"
|
|
plusRacketFail : Int -> Int -> Int
|
|
|
|
-- We don't actually do any printing this is just to use the specifiers so the
|
|
-- failures are exposed.
|
|
main : IO ()
|
|
main = do
|
|
printLn $ plusGeneric 2 3
|
|
printLn $ plusChez 2 3
|
|
printLn $ plusRacketOK 2 3
|
|
printLn $ plusRacketFail 2 3
|
|
pure ()
|