feat(leanpkg): add initial support for test command
This commit is contained in:
parent
c396e4519a
commit
191a3d662d
3 changed files with 26 additions and 2 deletions
|
|
@ -45,11 +45,23 @@ assg ← solve_deps d,
|
|||
path_file_cnts ← mk_path_file <$> construct_path assg,
|
||||
write_file "leanpkg.path" path_file_cnts
|
||||
|
||||
def make : io unit :=
|
||||
exec_cmd { cmd := "lean", args := ["--make"], env := [("LEAN_PATH", none)] }
|
||||
|
||||
def make : io unit := do
|
||||
manifest ← read_manifest,
|
||||
let src_path := manifest.path.get_or_else "src",
|
||||
exec_cmd {
|
||||
cmd := "lean",
|
||||
args := ["--make", src_path],
|
||||
env := [("LEAN_PATH", none)]
|
||||
}
|
||||
|
||||
def build := configure >> make
|
||||
|
||||
def make_test : io unit :=
|
||||
exec_cmd { cmd := "lean", args := ["--make", "test"], env := [("LEAN_PATH", none)] }
|
||||
|
||||
def test := configure >> make_test
|
||||
|
||||
def init_gitignore_contents :=
|
||||
"*.olean
|
||||
/_target
|
||||
|
|
@ -120,6 +132,7 @@ Usage: leanpkg <command>
|
|||
|
||||
configure download dependencies
|
||||
build download dependencies and build *.olean files
|
||||
test download dependencies and run test files
|
||||
|
||||
new <dir> creates a lean package in the specified directory
|
||||
init <name> adds a leanpkg.toml file to the current directory, and sets up .gitignore
|
||||
|
|
@ -136,6 +149,7 @@ dump prints the parsed leanpkg.toml file (for debugging)
|
|||
def main : ∀ (args : list string), io unit
|
||||
| ["configure"] := configure
|
||||
| ["build"] := build
|
||||
| ["test"] := test
|
||||
| ["new", dir] := new dir
|
||||
| ["init", name] := init name
|
||||
| ["add", dep] := add dep
|
||||
|
|
|
|||
|
|
@ -790,6 +790,9 @@ tactic.apply_auto_param
|
|||
meta def fail_if_success (tac : itactic) : tactic unit :=
|
||||
tactic.fail_if_success tac
|
||||
|
||||
meta def success_if_fail (tac : itactic) : tactic unit :=
|
||||
tactic.success_if_fail tac
|
||||
|
||||
meta def guard_expr_eq (t : expr) (p : parse $ tk ":=" *> texpr) : tactic unit :=
|
||||
do e ← to_expr p, guard (alpha_eqv t e)
|
||||
|
||||
|
|
|
|||
|
|
@ -86,6 +86,13 @@ meta def fail_if_success {α : Type u} (t : tactic α) : tactic unit :=
|
|||
(λ a s, mk_exception "fail_if_success combinator failed, given tactic succeeded" none s)
|
||||
(λ e ref s', success () s)
|
||||
|
||||
meta def success_if_fail {α : Type u} (t : tactic α) : tactic unit :=
|
||||
λ s, match t s with
|
||||
| (interaction_monad.result.exception _ _ s') := success () s
|
||||
| (interaction_monad.result.success a s) :=
|
||||
mk_exception "success_if_fail combinator failed, given tactic succeeded" none s
|
||||
end
|
||||
|
||||
open nat
|
||||
/- (repeat_at_most n t): repeat the given tactic at most n times or until t fails -/
|
||||
meta def repeat_at_most : nat → tactic unit → tactic unit
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue