Created
August 20, 2015 21:03
-
-
Save danlamanna/c2102c3bc14d5b6c9d66 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun helm-ctest-candidates() | |
| (let* ((ctest-output (shell-command-to-string "cd ~/projects/romanesco/build && ctest -N")) | |
| (tests (-butlast (-drop 1 (s-split "\n" ctest-output))))) | |
| (-map (lambda(test-line) | |
| (s-trim | |
| (s-chop-prefix "Test" | |
| (s-trim test-line)))) tests))) | |
| (defun helm-ctest-build-command(tests) | |
| (concat "ctest -I " | |
| (s-join "," (-map (lambda(test-num) | |
| (format "%d,%d," test-num test-num)) tests)))) | |
| (setq some-helm-source | |
| `((name . "Tests") | |
| (candidates . ,(helm-ctest-candidates)) | |
| (action . (("run tests" . | |
| (lambda(candidate) | |
| (let ((compile-command (format "cd ~/projects/romanesco/build && %s" (helm-ctest-build-command | |
| (-map 'string-to-number | |
| (-map (lambda(candidate-str) | |
| (car (cdr (s-match "#\\([[:digit:]]+\\)" candidate-str)))) | |
| (helm-marked-candidates))))))) | |
| (compile compile-command)))))))) | |
| (helm :sources '(some-helm-source)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment