From 636ee0e17517471a37cefd86f4f503989ac9bb8b Mon Sep 17 00:00:00 2001
From: Matt DeBoard <matt.deboard@gmail.com>
Date: Thu, 10 Jul 2014 18:06:06 -0400
Subject: [PATCH 1/2] Add test that *should* be failing. Refs #36

The test results conflict with what I see in the buffer.
---
 elixir-mode.el                 | 58 ++++++++++++++++++----------------
 test/elixir-mode-font-tests.el |  8 +++++
 2 files changed, 39 insertions(+), 27 deletions(-)

diff --git a/elixir-mode.el b/elixir-mode.el
index 1751823e..72c76f73 100644
--- a/elixir-mode.el
+++ b/elixir-mode.el
@@ -298,6 +298,37 @@
 
 (defconst elixir-mode-font-lock-defaults
   `(
+    ;; Regex patterns. Elixir has support for eight different regex delimiters.
+    ;; This isn't a very DRY approach here but it gets the job done.
+    (,(elixir-rx "~r"
+                 (and "/" (group (one-or-more (not (any "/")))) "/"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "[" (group (one-or-more (not (any "]")))) "]"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "{" (group (one-or-more (not (any "}")))) "}"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "(" (group (one-or-more (not (any ")")))) ")"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "|" (group (one-or-more (not (any "|")))) "|"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "\"" (group (one-or-more (not (any "\"")))) "\""))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "'" (group (one-or-more (not (any "'")))) "'"))
+     1 font-lock-string-face)
+    (,(elixir-rx "~r"
+                  (and "<" (group (one-or-more (not (any ">")))) ">"))
+     1 font-lock-string-face)
+
+    ;; Code points (i.e. `?c')
+    (,(elixir-rx (group code-point))
+     1 font-lock-reference-face)
+
     ;; Import, module- and method-defining keywords
     (,(elixir-rx (or method-defines module-defines imports)
                  space
@@ -329,33 +360,6 @@
     (,(elixir-rx (group sigils))
      1 font-lock-builtin-face)
 
-    ;; Regex patterns. Elixir has support for eight different regex delimiters.
-    ;; This isn't a very DRY approach here but it gets the job done.
-    (,(elixir-rx "~r"
-                 (and "/" (group (one-or-more (not (any "/")))) "/"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "[" (group (one-or-more (not (any "]")))) "]"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "{" (group (one-or-more (not (any "}")))) "}"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "(" (group (one-or-more (not (any ")")))) ")"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "|" (group (one-or-more (not (any "|")))) "|"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "\"" (group (one-or-more (not (any "\"")))) "\""))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "'" (group (one-or-more (not (any "'")))) "'"))
-     1 font-lock-string-face)
-    (,(elixir-rx "~r"
-                  (and "<" (group (one-or-more (not (any ">")))) ">"))
-     1 font-lock-string-face)
-
     ;; Built-in modules
     (,(elixir-rx (group builtin-modules))
      1 font-lock-constant-face)
diff --git a/test/elixir-mode-font-tests.el b/test/elixir-mode-font-tests.el
index 5d781461..de9ba67b 100644
--- a/test/elixir-mode-font-tests.el
+++ b/test/elixir-mode-font-tests.el
@@ -46,3 +46,11 @@ buffer."
    (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))))
+
+(ert-deftest elixir-mode-syntax-table/fontify-regex-with-question-mark ()
+  :tags '(fontification syntax-table)
+  (elixir-test-with-temp-buffer
+      "ptn = ~r/^user-mnl6yssn: (?<ct>\d+)$/mg"
+    (should (eq (elixir-test-face-at 10) 'font-lock-string-face))
+    (should (eq (elixir-test-face-at 28) 'font-lock-string-face))
+    (should (eq (elixir-test-face-at 30) 'font-lock-string-face))))

From b78e6b8a2872c833e34d78cbf162f39cd3ae59a2 Mon Sep 17 00:00:00 2001
From: Matt DeBoard <matt.deboard@gmail.com>
Date: Fri, 15 Aug 2014 17:10:02 -0500
Subject: [PATCH 2/2] Add comment explaining where I left off.

---
 test/elixir-mode-font-tests.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/test/elixir-mode-font-tests.el b/test/elixir-mode-font-tests.el
index de9ba67b..f423bd89 100644
--- a/test/elixir-mode-font-tests.el
+++ b/test/elixir-mode-font-tests.el
@@ -47,10 +47,12 @@ buffer."
    (should (eq (elixir-test-face-at 52) 'font-lock-type-face))
    (should (eq (elixir-test-face-at 53) 'font-lock-type-face))))
 
+;; This SHOULD fail, but it does not. `?<' is fontified like a builtin, but
+;; the characters afterward are not.
 (ert-deftest elixir-mode-syntax-table/fontify-regex-with-question-mark ()
   :tags '(fontification syntax-table)
   (elixir-test-with-temp-buffer
       "ptn = ~r/^user-mnl6yssn: (?<ct>\d+)$/mg"
     (should (eq (elixir-test-face-at 10) 'font-lock-string-face))
     (should (eq (elixir-test-face-at 28) 'font-lock-string-face))
-    (should (eq (elixir-test-face-at 30) 'font-lock-string-face))))
+    (should (eq (elixir-test-face-at 31) 'font-lock-string-face))))
