Skip to content

Add test for SQL font-lock #1067

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2016
Merged
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
2 changes: 1 addition & 1 deletion haskell-font-lock.el
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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