Compare commits
2 commits
c8acc534a9
...
b28b91d5d2
Author | SHA1 | Date | |
---|---|---|---|
b28b91d5d2 | |||
a0ba82ab38 |
8 changed files with 153 additions and 1 deletions
2
examples/testy/.gitignore
vendored
Normal file
2
examples/testy/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
build/
|
||||
*.*~
|
10
examples/testy/pack.toml
Normal file
10
examples/testy/pack.toml
Normal file
|
@ -0,0 +1,10 @@
|
|||
[custom.all.testy]
|
||||
type = "local"
|
||||
path = "."
|
||||
ipkg = "testy.ipkg"
|
||||
test = "test/test.ipkg"
|
||||
|
||||
[custom.all.testy-test]
|
||||
type = "local"
|
||||
path = "test"
|
||||
ipkg = "test.ipkg"
|
11
examples/testy/src/Testy.idr
Normal file
11
examples/testy/src/Testy.idr
Normal file
|
@ -0,0 +1,11 @@
|
|||
module Testy
|
||||
|
||||
import System
|
||||
import Data.String
|
||||
|
||||
-- @@test Hello World non-null
|
||||
helloNonNull : IO ()
|
||||
helloNonNull =
|
||||
if null "Hello World"
|
||||
then exitFailure
|
||||
else exitSuccess
|
19
examples/testy/test/src/Main.idr
Normal file
19
examples/testy/test/src/Main.idr
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Main
|
||||
|
||||
import System
|
||||
|
||||
-- @@test Main Test
|
||||
main : IO ()
|
||||
main = putStrLn "Test successful!"
|
||||
|
||||
-- @@test Failing integration with error message
|
||||
ohNo : IO ()
|
||||
ohNo = do
|
||||
putStrLn "Something horrible has happened"
|
||||
exitFailure
|
||||
|
||||
-- @@test Passing integration with output
|
||||
ohYes : IO ()
|
||||
ohYes = do
|
||||
putStrLn "Something amazing has happened"
|
||||
exitSuccess
|
11
examples/testy/test/src/TestModule/Booleans.idr
Normal file
11
examples/testy/test/src/TestModule/Booleans.idr
Normal file
|
@ -0,0 +1,11 @@
|
|||
module TestModule.Booleans
|
||||
|
||||
import System
|
||||
|
||||
-- @@test Boolean Integration passes
|
||||
doesWork : IO Bool
|
||||
doesWork = pure True
|
||||
|
||||
-- @@test Boolean Integration fails
|
||||
dontWork : IO Bool
|
||||
dontWork = pure False
|
48
examples/testy/test/test.ipkg
Normal file
48
examples/testy/test/test.ipkg
Normal file
|
@ -0,0 +1,48 @@
|
|||
package testytest
|
||||
version = 0.1.0
|
||||
authors = "Nathan McCarty"
|
||||
-- maintainers =
|
||||
-- license =
|
||||
-- brief =
|
||||
-- readme =
|
||||
-- homepage =
|
||||
-- sourceloc =
|
||||
-- bugtracker =
|
||||
|
||||
-- the Idris2 version required (e.g. langversion >= 0.5.1)
|
||||
-- langversion
|
||||
|
||||
-- packages to add to search path
|
||||
depends = testy
|
||||
|
||||
-- modules to install
|
||||
modules = Main
|
||||
, TestModule.Booleans
|
||||
|
||||
-- main file (i.e. file to load at REPL)
|
||||
main = Main
|
||||
|
||||
-- name of executable
|
||||
executable = "testy-test"
|
||||
-- opts =
|
||||
sourcedir = "src"
|
||||
-- builddir =
|
||||
-- outputdir =
|
||||
|
||||
-- script to run before building
|
||||
-- prebuild =
|
||||
|
||||
-- script to run after building
|
||||
-- postbuild =
|
||||
|
||||
-- script to run after building, before installing
|
||||
-- preinstall =
|
||||
|
||||
-- script to run after installing
|
||||
-- postinstall =
|
||||
|
||||
-- script to run before cleaning
|
||||
-- preclean =
|
||||
|
||||
-- script to run after cleaning
|
||||
-- postclean =
|
47
examples/testy/testy.ipkg
Normal file
47
examples/testy/testy.ipkg
Normal file
|
@ -0,0 +1,47 @@
|
|||
package testy
|
||||
version = 0.1.0
|
||||
authors = "Nathan McCarty"
|
||||
-- maintainers =
|
||||
-- license =
|
||||
-- brief =
|
||||
-- readme =
|
||||
-- homepage =
|
||||
-- sourceloc =
|
||||
-- bugtracker =
|
||||
|
||||
-- the Idris2 version required (e.g. langversion >= 0.5.1)
|
||||
-- langversion
|
||||
|
||||
-- packages to add to search path
|
||||
-- depends =
|
||||
|
||||
-- modules to install
|
||||
modules = Testy
|
||||
|
||||
-- main file (i.e. file to load at REPL)
|
||||
-- main =
|
||||
|
||||
-- name of executable
|
||||
-- executable =
|
||||
-- opts =
|
||||
sourcedir = "src"
|
||||
-- builddir =
|
||||
-- outputdir =
|
||||
|
||||
-- script to run before building
|
||||
-- prebuild =
|
||||
|
||||
-- script to run after building
|
||||
-- postbuild =
|
||||
|
||||
-- script to run after building, before installing
|
||||
-- preinstall =
|
||||
|
||||
-- script to run after installing
|
||||
-- postinstall =
|
||||
|
||||
-- script to run before cleaning
|
||||
-- preclean =
|
||||
|
||||
-- script to run after cleaning
|
||||
-- postclean =
|
|
@ -51,6 +51,8 @@ class IdrisError is Exception {
|
|||
qq:to/END/;
|
||||
Error running idris command: $.command
|
||||
Command exited with $.exit-code
|
||||
StdOut:
|
||||
{$.out.lines.map(*.indent: 2).join("\n")}
|
||||
END
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +77,7 @@ sub idris-run(*@cmd) is export {
|
|||
my $proc = run "idris2", @cmd, :out, :err;
|
||||
my $out = $proc.out.slurp(:close);
|
||||
my $err = $proc.err.slurp(:close);
|
||||
unless $proc {
|
||||
if !$proc || $out.contains("Error:") {
|
||||
IdrisError.new(
|
||||
out => $out, err => $err,
|
||||
exit-code => $proc.exitcode, command => @cmd.Str)
|
||||
|
@ -117,5 +119,7 @@ sub idris-exec($expr, $file, $output-type? = Unit) is export {
|
|||
exit-code => $proc.exitcode, expr => $expr
|
||||
).throw;
|
||||
}
|
||||
# Remove the output file
|
||||
'build/exec/iutils_out'.IO.unlink;
|
||||
return $out;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue