Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Added new functions for getting skip tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
oubiwann committed Jul 18, 2014
1 parent c31e174 commit 46e35eb
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/lfetool-plugin.lfe
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,48 @@
(lutil-file:expand-home-dir
(lfetool-const:plugin-beams)))))

;; XXX move into lutil
(defun get-beam-exports (beam)
"Given an atom representing a plugin's name, return its module
attributes."
(let (((tuple 'ok (tuple _ (list (tuple 'exports exports))))
(beam_lib:chunks beam '(exports))))
exports))

;; XXX move into lutil
(defun get-module-exports (module)
(get-beam-exports (code:which module)))

(defun check-skip-funcs (funcs)
(lists:map
(match-lambda
(((tuple func arity))
(case (re:run (atom_to_list func) (lfetool-const:skip-test-patt))
((tuple 'match _) `#(,func ,arity))
(_ 'false))))
funcs))

(defun check-skipped-tests (funcs)
(lists:map
(match-lambda
(((tuple func arity))
(case (re:split (atom_to_list func)
(++ (lfetool-const:skip-test-group-patt))
'(#(return list)))
((list '() test-name _ '()) test-name)
(_ 'false))))
funcs))

(defun get-skip-funcs (module)
(lutil-file:filtered
#'check-skip-funcs/1
(get-module-exports module)))

(defun get-skipped-tests (module)
(lutil-file:filtered
#'check-skipped-tests/1
(get-module-exports module)))

(defun load-plugins ()
(lutil-file:load-beams
(get-plugin-beams)))
Expand Down

0 comments on commit 46e35eb

Please sign in to comment.