Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .ert-runner
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-L .
--quiet

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*\~
._*
/.cask/
/dist/
9 changes: 9 additions & 0 deletions Cask
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(source gnu)
(source melpa)

(package-file "elixir-mode.el")

(files "*.el")

(development
(depends-on "ert-runner"))
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,6 @@ add the following in your .emacs file:
<td><code>elixir-mode-open-docs-stable</code></td>
<td>Open the Elixir documentation for the latest stable release.</td>
</tr>
<tr>
<td><code>elixir-mode-run-tests</code></td>
<td>Run ERT tests for `elixir-mode`.</td>
</tr>
<tr>
<td><code>elixir-mode-show-version</code></td>
<td>Print version info for elixir-mode.</td>
Expand Down
28 changes: 0 additions & 28 deletions elixir-mode-tests.el

This file was deleted.

11 changes: 0 additions & 11 deletions elixir-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@
;;
;; Open the Elixir documentation for the latest stable release.
;;
;; M-x elixir-mode-run-tests
;;
;; Run ERT tests for `elixir-mode`.
;;
;; M-x elixir-mode-show-version
;;
;; Print `elixir-mode` version.
Expand Down Expand Up @@ -667,13 +663,6 @@ Argument END End of the region."
:keymap '(("q" . quit-window))
(setq buffer-read-only t))

;;;###autoload
(defun elixir-mode-run-tests ()
"Run ERT test for `elixir-mode'."
(interactive)
(load "elixir-mode-tests")
(ert-run-tests-interactively "^elixir-ert-.*$"))

;; Invoke elixir-mode when appropriate

;;;###autoload
Expand Down
8 changes: 0 additions & 8 deletions ert-bootstrap.el

This file was deleted.

36 changes: 0 additions & 36 deletions run_tests

This file was deleted.

130 changes: 130 additions & 0 deletions test/elixir-mode-font-test.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@

(elixir-deftest syntax-table/fontify-regex
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"match = ~r/foo/"
(should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 9) 'font-lock-builtin-face))
(should (eq (elixir-test-face-at 12) 'font-lock-string-face))
;; no face for regex delimiters
(should (eq (elixir-test-face-at 15) nil))))

(elixir-deftest syntax-table/fontify-modules-and-types
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"defmodule Application.Behavior do
use Application.Behaviour"
(should (eq (elixir-test-face-at 1) 'font-lock-keyword-face))
(should (eq (elixir-test-face-at 11) 'font-lock-type-face))
(should (eq (elixir-test-face-at 22) 'font-lock-type-face))
(should (eq (elixir-test-face-at 23) 'font-lock-type-face))
(should (eq (elixir-test-face-at 32) 'font-lock-keyword-face))
(should (eq (elixir-test-face-at 37) 'font-lock-keyword-face))
(should (eq (elixir-test-face-at 41) 'font-lock-type-face))
(should (eq (elixir-test-face-at 52) 'font-lock-type-face))
(should (eq (elixir-test-face-at 53) 'font-lock-type-face))))

;; http://github.com/elixir-lang/emacs-elixir/issues/23
(elixir-deftest syntax-table/fontify-regex-with-quote
:tags '(fontification syntax-table)
:expected-result :failed
(elixir-test-with-test-buffer ()
"~r/\"/
x = 15"
(should (eq (elixir-test-face-at 7) 'font-lock-variable-name-face))))

;; http://github.com/elixir-lang/emacs-elixir/issues/36
(elixir-deftest syntax-table/fontify-regex-with-question/1
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"~r/^matt: (?<ct>\d+)$/mg
x = 15"
(should (eq (elixir-test-face-at 4) 'font-lock-string-face))
(should (eq (elixir-test-face-at 25) 'font-lock-variable-name-face))))

;; http://github.com/elixir-lang/emacs-elixir/issues/29
(elixir-deftest syntax-table/fontify-regex-with-question/2
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"a = \"\" <> \"?\"
x = 15"
(should (eq (elixir-test-face-at 15) 'font-lock-variable-name-face))))

(elixir-deftest syntax-table/fontify-function-name/1
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"def fooBar do
:foo
end"
(should (eq (elixir-test-face-at 5) 'font-lock-function-name-face))
(should (eq (elixir-test-face-at 8) 'font-lock-function-name-face))))

(elixir-deftest syntax-table/fontify-function-name/2
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"def foo? do
:foo
end"
(should (eq (elixir-test-face-at 5) 'font-lock-function-name-face))
(should (eq (elixir-test-face-at 8) 'font-lock-function-name-face))))

(elixir-deftest syntax-table/fontify-function-name/3
:tags '(fontification syntax-table)
(elixir-test-with-test-buffer ()
"def foo! do
:foo
end"
(should (eq (elixir-test-face-at 5) 'font-lock-function-name-face))
(should (eq (elixir-test-face-at 8) 'font-lock-function-name-face))))

(elixir-deftest syntax-table/fontify-heredoc/1
:tags '(fontification heredoc syntax-table)
(elixir-test-with-test-buffer ()
"@doc \"\"\""
(should (eq (elixir-test-face-at 1) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 2) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 6) 'font-lock-string-face))))

(elixir-deftest syntax-table/fontify-heredoc/2
:tags '(fontification heredoc syntax-table)
(elixir-test-with-test-buffer ()
"@moduledoc \"\"\""
(should (eq (elixir-test-face-at 1) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 2) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 12) 'font-lock-string-face))))

(elixir-deftest syntax-table/fontify-heredoc/3
:tags '(fontification heredoc syntax-table)
(elixir-test-with-test-buffer ()
"~s\"\"\""
(should (eq (elixir-test-face-at 1) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 2) 'elixir-attribute-face))
(should (eq (elixir-test-face-at 3) 'font-lock-string-face))))

(elixir-deftest syntax-table/fontify-atoms
:tags '(fontification atom syntax-table)
(elixir-test-with-test-buffer ()
":oriole
:andale"
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
(should (eq (elixir-test-face-at 5) 'elixir-atom-face))
(should (eq (elixir-test-face-at 10) 'elixir-atom-face))
(should (eq (elixir-test-face-at 13) 'elixir-atom-face))))

(elixir-deftest syntax-table/fontify-map-keys
:tags '(fontification map syntax-table)
(elixir-test-with-test-buffer ()
"%{a: 1, b: 2}"
(should (eq (elixir-test-face-at 3) 'elixir-atom-face))
(should (eq (elixir-test-face-at 4) 'elixir-atom-face))
(should (eq (elixir-test-face-at 9) 'elixir-atom-face))
(should (eq (elixir-test-face-at 10) 'elixir-atom-face))))

(elixir-deftest syntax-table/fontify-interpolation
:tags '(fontification interpolation syntax-table)
(elixir-test-with-test-buffer ()
"\"#{1 + 2} is 3.\""
(should (eq (elixir-test-face-at 1) 'font-lock-string-face))
(should (eq (elixir-test-face-at 3) 'font-lock-variable-name-face))
(should (eq (elixir-test-face-at 11) 'font-lock-string-face))))

Loading