1;;; alchemist-server-test.el --- 2 3;; Copyright © 2015 Samuel Tonini 4;; 5;; Author: Samuel Tonini <tonini.samuel@gmail.com> 6 7;; This file is not part of GNU Emacs. 8 9;; This program is free software: you can redistribute it and/or modify 10;; it under the terms of the GNU General Public License as published by 11;; the Free Software Foundation, either version 3 of the License, or 12;; (at your option) any later version. 13 14;; This program is distributed in the hope that it will be useful, 15;; but WITHOUT ANY WARRANTY; without even the implied warranty of 16;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17;; GNU General Public License for more details. 18 19;; You should have received a copy of the GNU General Public License 20;; along with this program. If not, see <http://www.gnu.org/licenses/>. 21 22;;; Commentary: 23 24;;; Code: 25 26(require 'test-helper) 27 28(ert-deftest not-inside-project/start-default-server () 29 (alchemist-server-start-if-not-running) 30 (should (string= "alchemist-server" 31 (process-name (alchemist-server-process)))) 32 (should (string= "run" 33 (process-status (process-name (alchemist-server-process)))))) 34 35(ert-deftest inside-project/start-project-server () 36 (with-sandbox 37 (f-touch "mix.exs") 38 (alchemist-server-start-if-not-running) 39 (should (string-match-p "alchemist\\.el\\/test\\/sandbox\\/.*$" 40 (process-name (alchemist-server-process)))) 41 (should (string= "run" 42 (process-status (process-name (alchemist-server-process))))))) 43 44(ert-deftest inside-project/get-process-name () 45 (with-sandbox 46 (f-touch "mix.exs") 47 (alchemist-server-start-if-not-running) 48 (should (string-match-p "alchemist\\.el\\/test\\/sandbox\\/.*$" 49 (alchemist-server-process-name))))) 50 51(ert-deftest check-if-process-is-running () 52 (should (progn 53 (alchemist-server-start-if-not-running) 54 (alchemist-server-process-p)))) 55 56(ert-deftest return-t-if-contain-end-marker () 57 (should-not (alchemist-server-contains-end-marker-p "")) 58 (should (alchemist-server-contains-end-marker-p "END-OF-DEFL")) 59 (should-not (alchemist-server-contains-end-marker-p "\n")) 60 (should-not (alchemist-server-contains-end-marker-p nil))) 61 62(provide 'alchemist-server-test) 63 64;;; alchemist-server-test.el ends here 65