1;;; elixir-mode-font-test.el --- Font highlighting testsuite 2 3;;; Commentary: 4;; 5;; `elixir-test-with-temp-buffer' and `elixir-test-face-at' are both slightly 6;; modified versions of the original at 7;; https://github.com/lunaryorn/puppet-mode/blob/master/test/puppet-mode-test.el 8 9;;; Code: 10 11(require 'test-helper) 12 13(defun elixir-test-face-at (pos &optional content) 14 "Get the face at POS in CONTENT. 15 16If CONTENT is not given, return the face at POS in the current 17buffer." 18 (if content 19 (elixir-test-with-temp-buffer content 20 (get-text-property pos 'face)) 21 (get-text-property pos 'face))) 22 23(ert-deftest elixir-mode-syntax-table/fontify-regex () 24 :tags '(fontification syntax-table) 25 (elixir-test-with-temp-buffer 26 "match = ~r/foo/ 27match=~r/foo/" 28 (should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face)) 29 (should (eq (elixir-test-face-at 9) 'font-lock-builtin-face)) 30 (should (eq (elixir-test-face-at 12) 'font-lock-string-face)) 31 (should (eq (elixir-test-face-at 18) 'font-lock-variable-name-face)) 32 ;; no face for regex delimiters 33 (should (eq (elixir-test-face-at 15) nil)))) 34 35(ert-deftest elixir-mode-syntax-table/sigils () 36 :tags '(fontification syntax-table) 37 (elixir-test-with-temp-buffer 38 "asdfg = ~s{Capitalized noncapitalized}" 39 (should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face)) 40 (should (eq (elixir-test-face-at 9) 'font-lock-builtin-face)) 41 (should (eq (elixir-test-face-at 12) 'font-lock-string-face)) 42 (should (eq (elixir-test-face-at 26) 'font-lock-string-face)) 43 ;; no face for regex delimiters 44 (should (eq (elixir-test-face-at 38) nil)))) 45 46(ert-deftest elixir-mode-syntax-table/fontify-special-macros () 47 :tags '(fontification syntax-table) 48 (elixir-test-with-temp-buffer 49 "__MODULE__ 50__DIR__ 51__aliases__ 52%__MODULE__ 53&__MODULE__ 54&abc__DIR__" 55 (should (eq (elixir-test-face-at 4) 'font-lock-constant-face)) 56 (should (eq (elixir-test-face-at 14) 'font-lock-constant-face)) 57 (should (eq (elixir-test-face-at 24) 'font-lock-constant-face)) 58 (should (eq (elixir-test-face-at 34) 'font-lock-constant-face)) 59 (should (eq (elixir-test-face-at 44) 'font-lock-constant-face)) 60 (should-not (eq (elixir-test-face-at 60) 'font-lock-constant-face)))) 61 62(ert-deftest elixir-mode-syntax-table/fontify-modules-and-types () 63 :tags '(fontification syntax-table) 64 (elixir-test-with-temp-buffer 65 "defmodule Application.Behavior do 66 use Application.Behaviour 67 Stand.Alone.call 68 %RuntimeError{message: msg} 69 &Enum" 70 (should (eq (elixir-test-face-at 1) 'font-lock-keyword-face)) 71 (should (eq (elixir-test-face-at 11) 'font-lock-type-face)) 72 (should (eq (elixir-test-face-at 22) 'font-lock-type-face)) 73 (should (eq (elixir-test-face-at 23) 'font-lock-type-face)) 74 (should (eq (elixir-test-face-at 32) 'font-lock-keyword-face)) 75 (should (eq (elixir-test-face-at 37) 'font-lock-keyword-face)) 76 (should (eq (elixir-test-face-at 41) 'font-lock-type-face)) 77 (should (eq (elixir-test-face-at 52) 'font-lock-type-face)) 78 (should (eq (elixir-test-face-at 53) 'font-lock-type-face)) 79 (should (eq (elixir-test-face-at 68) 'font-lock-type-face)) 80 (should (eq (elixir-test-face-at 72) 'font-lock-type-face)) 81 (should (eq (elixir-test-face-at 114) 'font-lock-type-face)) 82 (should (eq (elixir-test-face-at 117) 'font-lock-type-face)) 83 ;; no face for function call 84 (should (eq (elixir-test-face-at 79) nil)) 85 (should (eq (elixir-test-face-at 84) 'font-lock-type-face)) 86 ;; no face for curly braces 87 (should (eq (elixir-test-face-at 97) nil)))) 88 89(ert-deftest elixir-mode-syntax-table/fontify-regex-with-quote () 90 "https://github.com/elixir-lang/emacs-elixir/issues/23" 91 :tags '(fontification syntax-table) 92 :expected-result :failed 93 (elixir-test-with-temp-buffer 94 "~r/\"/ 95x = 15" 96 (should (eq (elixir-test-face-at 8) 'font-lock-variable-name-face)))) 97 98(ert-deftest elixir-mode-syntax-table/fontify-regex-with-question/1 () 99 "https://github.com/elixir-lang/emacs-elixir/issues/36" 100 :tags '(fontification syntax-table) 101 (elixir-test-with-temp-buffer 102 "~r/^matt: (?<ct>\d+)$/mg 103x = 15" 104 (should (eq (elixir-test-face-at 4) 'font-lock-string-face)) 105 (should (eq (elixir-test-face-at 25) 'font-lock-variable-name-face)))) 106 107(ert-deftest elixir-mode-syntax-table/fontify-regex-with-question/2 () 108 "https://github.com/elixir-lang/emacs-elixir/issues/29" 109 :tags '(fontification syntax-table) 110 (elixir-test-with-temp-buffer 111 "a = \"\" <> \"?\" 112x = 15" 113 (should (eq (elixir-test-face-at 15) 'font-lock-variable-name-face)))) 114 115(ert-deftest elixir-mode-syntax-table/fontify-function-name/1 () 116 :tags '(fontification syntax-table) 117 (elixir-test-with-temp-buffer 118 "def fooBar do 119 :foo 120end" 121 (should (eq (elixir-test-face-at 5) 'font-lock-function-name-face)) 122 (should (eq (elixir-test-face-at 8) 'font-lock-function-name-face)))) 123 124(ert-deftest elixir-mode-syntax-table/fontify-function-name/2 () 125 :tags '(fontification syntax-table) 126 (elixir-test-with-temp-buffer 127 "def foo? do 128 :foo 129end" 130 (should (eq (elixir-test-face-at 5) 'font-lock-function-name-face)) 131 (should (eq (elixir-test-face-at 8) 'font-lock-function-name-face)))) 132 133(ert-deftest elixir-mode-syntax-table/fontify-function-name/3 () 134 :tags '(fontification syntax-table) 135 (elixir-test-with-temp-buffer 136 "def foo! do 137 :foo 138end" 139 (should (eq (elixir-test-face-at 5) 'font-lock-function-name-face)) 140 (should (eq (elixir-test-face-at 8) 'font-lock-function-name-face)))) 141 142(ert-deftest elixir-mode-syntax-table/fontify-defoverridable/1 () 143 :tags '(fontification syntax-table) 144 (elixir-test-with-temp-buffer 145 "defmodule Foo do 146 defmacro __using__(_opts) do 147 quote do 148 def bar, do: :ok 149 defoverridable [bar: 0] 150 end 151 end 152end" 153 (should (eq (elixir-test-face-at 91) 'font-lock-keyword-face)))) 154 155(ert-deftest elixir-mode-syntax-table/fontify-end-if-the-last-line-in-a-module-is-a-comment () 156 "https://github.com/elixir-lang/emacs-elixir/issues/283" 157 :tags '(fontification syntax-table) 158 (elixir-test-with-temp-buffer 159 "defmodule Foo do 160 # foo 161end" 162 (should (eq (elixir-test-face-at 26) 'font-lock-keyword-face)))) 163 164(ert-deftest elixir-mode-syntax-table/fontify-heredoc/1 () 165 :tags '(fontification heredoc syntax-table) 166 (elixir-test-with-temp-buffer 167 "@doc \"\"\"" 168 (should (eq (elixir-test-face-at 1) 'elixir-attribute-face)) 169 (should (eq (elixir-test-face-at 2) 'elixir-attribute-face)) 170 (should (eq (elixir-test-face-at 6) 'font-lock-string-face)))) 171 172(ert-deftest elixir-mode-syntax-table/fontify-heredoc/2 () 173 :tags '(fontification heredoc syntax-table) 174 (elixir-test-with-temp-buffer 175 "@moduledoc \"\"\"" 176 (should (eq (elixir-test-face-at 1) 'elixir-attribute-face)) 177 (should (eq (elixir-test-face-at 2) 'elixir-attribute-face)) 178 (should (eq (elixir-test-face-at 12) 'font-lock-string-face)))) 179 180(ert-deftest elixir-mode-syntax-table/fontify-heredoc/3 () 181 :tags '(fontification heredoc syntax-table) 182 (elixir-test-with-temp-buffer 183 "~s\"\"\"" 184 (should (eq (elixir-test-face-at 1) 'font-lock-builtin-face)) 185 (should (eq (elixir-test-face-at 2) 'font-lock-builtin-face)) 186 (should (eq (elixir-test-face-at 3) 'font-lock-string-face)))) 187 188(ert-deftest elixir-mode-syntax-table/fontify-atoms () 189 :tags '(fontification atom syntax-table) 190 (elixir-test-with-temp-buffer 191 ":oriole 192:andale 193:ms2pid 194:CapitalizedAtom 195true 196false 197nil 198true_false_nil 199:insert! 200:insert@ 201:insert? 202" 203 (should (eq (elixir-test-face-at 3) 'elixir-atom-face)) 204 (should (eq (elixir-test-face-at 5) 'elixir-atom-face)) 205 (should (eq (elixir-test-face-at 10) 'elixir-atom-face)) 206 (should (eq (elixir-test-face-at 13) 'elixir-atom-face)) 207 (should (eq (elixir-test-face-at 18) 'elixir-atom-face)) 208 (should (eq (elixir-test-face-at 23) 'elixir-atom-face)) 209 (should (eq (elixir-test-face-at 26) 'elixir-atom-face)) 210 (should (eq (elixir-test-face-at 43) 'elixir-atom-face)) 211 (should (eq (elixir-test-face-at 48) 'elixir-atom-face)) 212 (should (eq (elixir-test-face-at 54) 'elixir-atom-face)) 213 (should-not (eq (elixir-test-face-at 57) 'elixir-atom-face)) 214 (should (eq (elixir-test-face-at 74) 'elixir-atom-face)) 215 (should (eq (elixir-test-face-at 82) 'elixir-atom-face)) 216 (should (eq (elixir-test-face-at 97) 'elixir-atom-face)))) 217 218(ert-deftest elixir-mode-syntax-table/fontify-map-keys () 219 :tags '(fontification map syntax-table) 220 (elixir-test-with-temp-buffer 221 "%{a: 1, b: 2}" 222 (should (eq (elixir-test-face-at 3) 'elixir-atom-face)) 223 (should (eq (elixir-test-face-at 4) 'elixir-atom-face)) 224 (should (eq (elixir-test-face-at 9) 'elixir-atom-face)) 225 (should (eq (elixir-test-face-at 10) 'elixir-atom-face))) 226 227 ;; https://github.com/elixir-lang/emacs-elixir/issues/320 228 (elixir-test-with-temp-buffer 229 "<<foo::bar>>" 230 (should-not (eq (elixir-test-face-at 3) 'elixir-atom-face)))) 231 232(ert-deftest elixir-mode-syntax-table/fontify-interpolation () 233 :tags '(fontification interpolation syntax-table) 234 (elixir-test-with-temp-buffer 235 "\"#{1 + 2} is 3.\"" 236 (should (eq (elixir-test-face-at 1) 'font-lock-string-face)) 237 (should (eq (elixir-test-face-at 11) 'font-lock-string-face)))) 238 239(ert-deftest elixir-mode-syntax-table/fontify-continuation-lines-assignment () 240 :tags '(fontification syntax-table) 241 (elixir-test-with-temp-buffer 242 "some_var = 243some_expr" 244 (should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face)))) 245 246(ert-deftest elixir-mode-syntax-table/dont-fontify-equal-match () 247 :tags '(fontification syntax-table) 248 (elixir-test-with-temp-buffer 249 "this == that" 250 (should-not (eq (elixir-test-face-at 2) 'font-lock-variable-name-face)))) 251 252(ert-deftest elixir-mode-syntax-table/fontify-triple-quoted-string () 253 :tags '(fontification syntax-table) 254 (elixir-test-with-temp-buffer 255 "\"\"\"foo\"bar\"baz #{1 + 2} is 3.\"\"\"" 256 (should (eq (elixir-test-face-at 1) 'font-lock-string-face)) 257 (should (eq (elixir-test-face-at 5) 'font-lock-string-face)) 258 (should (eq (elixir-test-face-at 19) 'font-lock-variable-name-face)) 259 (should (eq (elixir-test-face-at 31) 'font-lock-string-face)))) 260 261(ert-deftest elixir-mode-syntax-table/fontify-atom-in-pattern-match () 262 :tags '(fontification atom syntax-table) 263 (elixir-test-with-temp-buffer 264 ":any = into_to_type(type) 265:another=into_to_type(type)" 266 (should (eq (elixir-test-face-at 3) 'elixir-atom-face)))) 267 268(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-pattern/1 () 269 :expected-result :failed 270 :tags '(fontification syntax-table) 271 (elixir-test-with-temp-buffer 272 "{x, y} = some_expr" 273 (should (eq (elixir-test-face-at 2) 'font-lock-variable-name-face)) 274 (should (eq (elixir-test-face-at 5) 'font-lock-variable-name-face)))) 275 276(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-pattern/2 () 277 :expected-result :failed 278 :tags '(fontification syntax-table) 279 (elixir-test-with-temp-buffer 280 "[h|t] = some_expr" 281 (should (eq (elixir-test-face-at 2) 'font-lock-variable-name-face)) 282 (should (eq (elixir-test-face-at 4) 'font-lock-variable-name-face)))) 283 284(ert-deftest elixir-mode-syntax-table/fontify-assignment-with-singleton () 285 "https://github.com/elixir-lang/emacs-elixir/issues/245" 286 :tags '(fontification syntax-table) 287 (elixir-test-with-temp-buffer 288 "true_false_nil = 1" 289 (should (eq (elixir-test-face-at 1) 'font-lock-variable-name-face)) 290 (should (eq (elixir-test-face-at 6) 'font-lock-variable-name-face)) 291 (should (eq (elixir-test-face-at 12) 'font-lock-variable-name-face)))) 292 293(ert-deftest elixir-mode-syntax-table/fontify-keyword-after-dot () 294 "https://github.com/elixir-lang/emacs-elixir/issues/250" 295 :tags '(fontification syntax-table) 296 (elixir-test-with-temp-buffer 297 "Mix.raise 298raise 299Mix.def foo 300Mix.import 301import 302Mix.after 303after 304Mix.when 305when" 306 (should-not (eq (elixir-test-face-at 5) 'font-lock-keyword-face)) 307 (should (eq (elixir-test-face-at 11) 'font-lock-keyword-face)) 308 (should-not (eq (elixir-test-face-at 21) 'font-lock-keyword-face)) 309 (should-not (eq (elixir-test-face-at 25) 'font-lock-function-name-face)) 310 (should-not (eq (elixir-test-face-at 33) 'font-lock-keyword-face)) 311 (should (eq (elixir-test-face-at 40) 'font-lock-keyword-face)) 312 313 (should-not (eq (elixir-test-face-at 51) 'font-lock-keyword-face)) 314 (should (eq (elixir-test-face-at 57) 'font-lock-keyword-face)) 315 (should-not (eq (elixir-test-face-at 67) 'font-lock-keyword-face)) 316 (should (eq (elixir-test-face-at 72) 'font-lock-keyword-face)))) 317 318(ert-deftest elixir-mode-syntax-table/highlight-send () 319 "Highlight send as a keyword" 320 :tags '(fontification syntax-table) 321 (elixir-test-with-temp-buffer 322 "defmodule Foo do 323 def bar(pid) do 324 send pid, :baz 325 end 326end" 327 (should (eq (elixir-test-face-at 40) 'font-lock-keyword-face)))) 328 329(ert-deftest elixir-mode-syntax-table/highlight-with () 330 "Highlight with as a keyword" 331 :tags '(fontification syntax-table) 332 (elixir-test-with-temp-buffer 333 "defmodule Foo do 334 def bar(opts) do 335 with( 336 {:ok, width} <- Map.fetch(opts, :width), 337 {:ok, height} <- Map.fetch(opts, :height), 338 do: {:ok, width * height} 339 ) 340 end 341end" 342 (should (eq (elixir-test-face-at 41) 'font-lock-keyword-face)))) 343 344(ert-deftest elixir-mode-syntax-table/string-interpolation-in-words-list () 345 "https://github.com/elixir-lang/emacs-elixir/issues/263" 346 :tags '(fontification syntax-table) 347 (elixir-test-with-temp-buffer 348 "~w(SADD users #{user_id})" 349 (should (eq (elixir-test-face-at 4) 'font-lock-string-face)) 350 351 (should-not (eq (elixir-test-face-at 15) 'font-lock-comment-face)) 352 (should-not (eq (elixir-test-face-at 17) 'font-lock-comment-face)) 353 (should-not (eq (elixir-test-face-at 25) 'font-lock-comment-face)))) 354 355(ert-deftest elixir-mode-syntax-table/quotes-in-sigils () 356 "https://github.com/elixir-lang/emacs-elixir/issues/265" 357 :tags '(fontification syntax-table) 358 (elixir-test-with-temp-buffer 359 "~s/\"/ 360~r|'| 361~c\"'\" 362~w'\"' 363~s(\") 364~r[\"] 365~c{\"} 366~w<\"> 367~s\"\"\" 368foo 369\"\"\"" 370 (should-not (eq (elixir-test-face-at 5) 'font-lock-string-face)) ; ~s// 371 372 (should-not (eq (elixir-test-face-at 7) 'font-lock-string-face)) ; ~r|| 373 (should (eq (elixir-test-face-at 7) 'font-lock-builtin-face)) 374 (should-not (eq (elixir-test-face-at 11) 'font-lock-string-face)) 375 376 (should-not (eq (elixir-test-face-at 13) 'font-lock-string-face)) ; ~c"" 377 (should (eq (elixir-test-face-at 13) 'font-lock-builtin-face)) 378 (should-not (eq (elixir-test-face-at 17) 'font-lock-string-face)) 379 380 (should-not (eq (elixir-test-face-at 19) 'font-lock-string-face)) ; ~w'' 381 (should (eq (elixir-test-face-at 19) 'font-lock-builtin-face)) 382 (should-not (eq (elixir-test-face-at 23) 'font-lock-string-face)) 383 384 (should-not (eq (elixir-test-face-at 25) 'font-lock-string-face)) ; ~s() 385 (should (eq (elixir-test-face-at 25) 'font-lock-builtin-face)) ; ~s() 386 (should-not (eq (elixir-test-face-at 29) 'font-lock-string-face)) 387 388 (should-not (eq (elixir-test-face-at 31) 'font-lock-string-face)) ; ~r[] 389 (should (eq (elixir-test-face-at 31) 'font-lock-builtin-face)) 390 (should-not (eq (elixir-test-face-at 35) 'font-lock-string-face)) 391 392 (should-not (eq (elixir-test-face-at 37) 'font-lock-string-face)) ; ~c{} 393 (should (eq (elixir-test-face-at 37) 'font-lock-builtin-face)) 394 (should-not (eq (elixir-test-face-at 41) 'font-lock-string-face)) 395 396 (should-not (eq (elixir-test-face-at 43) 'font-lock-string-face)) ; ~w<> 397 (should (eq (elixir-test-face-at 43) 'font-lock-builtin-face)) 398 (should-not (eq (elixir-test-face-at 47) 'font-lock-string-face)) 399 400 (should (eq (elixir-test-face-at 51) 'font-lock-string-face)) ; ~s""" """ 401 (should (eq (elixir-test-face-at 52) 'font-lock-string-face)) 402 (should (eq (elixir-test-face-at 53) 'font-lock-string-face)) 403 (should (eq (elixir-test-face-at 55) 'font-lock-string-face)))) 404 405(ert-deftest elixir-mode-syntax-table/hashmark-in-sigils () 406 "Don't treat hashmark in sigils as comment" 407 :tags '(fontification syntax-table) 408 (elixir-test-with-temp-buffer 409 "~s(# foo)" 410 (should-not (eq (elixir-test-face-at 4) 'font-lock-comment-face)) 411 (should (eq (elixir-test-face-at 6) 'font-lock-string-face)))) 412 413(ert-deftest elixir-mode-syntax-table/highlight-modules-after-pipe () 414 "Module names must be hightligthed if preceded by a pipe character." 415 (elixir-test-with-temp-buffer 416 "|List" 417 (should-not (eq (elixir-test-face-at 1) 'font-lock-type-face)) 418 (should (eq (elixir-test-face-at 3) 'font-lock-type-face))) 419 (elixir-test-with-temp-buffer 420 "[req_code(op_name)|Enum.reverse(data)]" 421 (should-not (eq (elixir-test-face-at 19) 'font-lock-type-face)) 422 (should (eq (elixir-test-face-at 21) 'font-lock-type-face)))) 423 424(ert-deftest elixir-mode-syntax-table/sigils-in-string () 425 "https://github.com/elixir-lang/emacs-elixir/issues/275" 426 :tags '(fontification syntax-table) 427 (elixir-test-with-temp-buffer 428 "@one 1 429@two \"~s\" 430@three :tre 431" 432 (should-not (eq (elixir-test-face-at 18) 'font-lock-string-face)) 433 (should (eq (elixir-test-face-at 19) 'elixir-attribute-face)) 434 (should-not (eq (elixir-test-face-at 25) 'font-lock-string-face)) 435 (should (eq (elixir-test-face-at 26) 'elixir-atom-face)))) 436 437(ert-deftest elixir-mode-syntax-table/sigil-triple-quote () 438 "https://github.com/elixir-lang/emacs-elixir/issues/286" 439 :tags '(fontification syntax-table) 440 (elixir-test-with-temp-buffer 441 "defmodule IEx do 442 @moduledoc ~S\"\"\" 443 Elixir's interactive shell. 444\"\"\" 445end 446" 447 (should (eq (elixir-test-face-at 33) 'font-lock-string-face)))) 448 449(ert-deftest elixir-mode-syntax-table/single-triple-single-quote () 450 "https://github.com/elixir-lang/emacs-elixir/issues/309" 451 :tags '(fontification syntax-table) 452 (elixir-test-with-temp-buffer 453 "defmodule Module do 454 @moduledoc ~S''' 455 foo's \"bar\" 456'''" 457 (should (eq (elixir-test-face-at 34) 'font-lock-builtin-face)) ;; ~S 458 (should (eq (elixir-test-face-at 35) 'font-lock-builtin-face)) 459 (should (eq (elixir-test-face-at 36) 'font-lock-string-face)) ;; ''' 460 (should (eq (elixir-test-face-at 37) 'font-lock-string-face)) 461 (should (eq (elixir-test-face-at 38) 'font-lock-string-face)) 462 (should (eq (elixir-test-face-at 54) 'font-lock-string-face)) ;; ''' 463 (should (eq (elixir-test-face-at 55) 'font-lock-string-face)) 464 (should (eq (elixir-test-face-at 56) 'font-lock-string-face)))) 465 466(ert-deftest elixir-mode-syntax-table/gray-out-ignored-var () 467 "https://github.com/elixir-lang/emacs-elixir/issues/292" 468 :tags '(fontification syntax-table) 469 (elixir-test-with-temp-buffer 470 "variable 471 _var 472 _x 473 _x! 474 _x? 475 _ 476 __MODULE__ 477" 478 (should (eq (elixir-test-face-at 4) nil)) 479 (should (eq (elixir-test-face-at 14) 'elixir-ignored-var-face)) 480 (should (eq (elixir-test-face-at 15) 'elixir-ignored-var-face)) 481 (should (eq (elixir-test-face-at 23) 'elixir-ignored-var-face)) 482 (should (eq (elixir-test-face-at 24) 'elixir-ignored-var-face)) 483 (should (eq (elixir-test-face-at 30) 'elixir-ignored-var-face)) 484 (should (eq (elixir-test-face-at 32) 'elixir-ignored-var-face)) 485 (should (eq (elixir-test-face-at 38) 'elixir-ignored-var-face)) 486 (should (eq (elixir-test-face-at 40) 'elixir-ignored-var-face)) 487 (should (eq (elixir-test-face-at 46) 'font-lock-constant-face)) 488 (should (eq (elixir-test-face-at 46) 'font-lock-constant-face)) 489 (should (eq (elixir-test-face-at 52) 'font-lock-constant-face)) 490 (should (eq (elixir-test-face-at 53) 'font-lock-constant-face)) 491 (should (eq (elixir-test-face-at 55) 'font-lock-constant-face)))) 492 493(ert-deftest elixir-mode-syntax-table/escaped-sigil-delimiter () 494 "https://github.com/elixir-lang/emacs-elixir/issues/302" 495 :tags '(fontification syntax-table) 496 (elixir-test-with-temp-buffer 497 "def player_id(video) do 498 ~r/^.*(?:youtu.be\\/|v\\/|e\\/|u\\/\\w+\\/|embed\\/|v=)(?<id>[^#\\&\\?]*).*/ 499 |> Regex.named_captures(video.url) 500 |> get_in([\"id\"]) 501end 502" 503 (should (eq (elixir-test-face-at 45) 'font-lock-string-face)) ;; escaped '/' 504 (should (eq (elixir-test-face-at 84) 'font-lock-string-face)) ;; comment mark '#' 505 506 (elixir-test-with-temp-buffer 507 "~B/\\// 508~C[\\]] 509~R{\\}} 510~C(\\)) 511~b|\\|| 512~c\"\\\"\" 513~r'\\'' 514~s<\\>>" 515 (should (eq (elixir-test-face-at 5) 'font-lock-string-face)) ;; '/' 516 (should (eq (elixir-test-face-at 12) 'font-lock-string-face)) ;; '[]' 517 (should (eq (elixir-test-face-at 19) 'font-lock-string-face)) ;; '{}' 518 (should (eq (elixir-test-face-at 26) 'font-lock-string-face)) ;; '()' 519 (should (eq (elixir-test-face-at 33) 'font-lock-string-face)) ;; '|' 520 (should (eq (elixir-test-face-at 40) 'font-lock-string-face)) ;; '"' 521 (should (eq (elixir-test-face-at 47) 'font-lock-string-face)) ;; '\'' 522 (should (eq (elixir-test-face-at 53) 'font-lock-string-face)) ;; '<>' 523 ))) 524 525(provide 'elixir-mode-font-test) 526 527;;; elixir-mode-font-test.el ends here 528