Skip to content

Commit

Permalink
Add test for SQL font-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
gracjan committed Jan 13, 2016
1 parent 0dcf996 commit 3e38565
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion haskell-font-lock.el
Expand Up @@ -27,7 +27,7 @@
;;; Code:

(require 'cl-lib)
(require 'haskell-mode)
(require 'haskell-compat)
(require 'font-lock)

(defcustom haskell-font-lock-symbols nil
Expand Down
1 change: 1 addition & 0 deletions haskell-mode.el
Expand Up @@ -140,6 +140,7 @@
(require 'haskell-sort-imports)
(require 'haskell-string)
(require 'haskell-indentation)
(require 'haskell-font-lock)

;; All functions/variables start with `(literate-)haskell-'.

Expand Down
23 changes: 23 additions & 0 deletions tests/haskell-font-lock-tests.el
Expand Up @@ -7,6 +7,9 @@
(insert line)
(insert "\n")))

;; Emacs 24.3 has sql-mode that runs without a product and therefore
;; without font lock initially and needs to be extra enabled
(add-hook 'sql-mode-hook (lambda () (sql-set-product 'ansi)))

(defun check-syntax-and-face-match-range (beg end syntax face)
"Check if all charaters between positions BEG and END have
Expand Down Expand Up @@ -424,6 +427,26 @@ if all of its characters have syntax and face. See
("Cons_p" t haskell-constructor-face)
("Cons_x" t haskell-quasi-quote-face))))

(ert-deftest haskell-syntactic-test-quasiquoter-sql-1 ()
"Embedded SQL statements"
(check-properties
'("sql = [sql| SELECT title FROM books; |]")
'(("SELECT" t font-lock-keyword-face)
("title" t nil)
("FROM" t font-lock-keyword-face)
("books" t nil))))

(ert-deftest haskell-syntactic-test-quasiquoter-sql-2 ()
"Embedded SQL statements"
:expected-result :failed
;; for now we have this problem that connstructor faces are used,
;; org-mode knows how to get around this problem
(check-properties
'("sql = [sql| SELECT Title FROM Books; |]")
'(("Title" t nil)
("Books" t nil))))


(ert-deftest haskell-syntactic-test-special-not-redefined ()
"QuasiQuote should not conflict with TemplateHaskell"
(check-properties
Expand Down

0 comments on commit 3e38565

Please sign in to comment.