branch: elpa/flx commit 3cd3bf768700330d40cec019926311875ff364d1 Author: Le Wang <l26w...@gmail.com> Commit: Le Wang <l26w...@gmail.com>
add perf test-case --- tests/flx-test.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/flx-test.el b/tests/flx-test.el index f8ea45572c..4eb8d9c5c8 100644 --- a/tests/flx-test.el +++ b/tests/flx-test.el @@ -34,6 +34,7 @@ (eval-when-compile (require 'cl)) (require 'ert) +(require 'async) (require 'flx) (ert-deftest flx-test-sanity () @@ -199,6 +200,7 @@ In this case, the match with more contiguous characters is better." ;;; makes, we've gone the opposite way. :) ;;; ;;; We strongly prefer basename matches, where as they do not. + (ert-deftest flx-imported-prioritizes-matches-after-/ () (let ((query "b")) (let ((higher (flx-score "foo/bar" query (flx-make-filename-cache))) @@ -348,6 +350,24 @@ substring can overpower abbreviation." (should (not upper-no-folds)))) +;;; perf + +(ert-deftest flx-prune-paths-optimizations () + "Make sure optimizations that prune bad paths early are working." + (let ((future (async-start + `(lambda () + ,(async-inject-variables "\\`load-path\\'") + (require 'flx) + (flx-score "~/foo/bar/blah.elllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll" "lllllll" (flx-make-filename-cache))) + nil)) + result) + (with-timeout (1 (kill-process future) ) + (while (not result) ;; while process is running + (sit-for .2) + (when (async-ready future) + (setq result (async-get future))))) + (should result))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; flx-test.el ends here