Skip to content

Commit 65f56a2

Browse files
committed
Merge pull request #1067 from gracjan/pr-sql-font-lock
Add test for SQL font-lock
2 parents 0dcf996 + 3e38565 commit 65f56a2

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

haskell-font-lock.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
;;; Code:
2828

2929
(require 'cl-lib)
30-
(require 'haskell-mode)
30+
(require 'haskell-compat)
3131
(require 'font-lock)
3232

3333
(defcustom haskell-font-lock-symbols nil

haskell-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
(require 'haskell-sort-imports)
141141
(require 'haskell-string)
142142
(require 'haskell-indentation)
143+
(require 'haskell-font-lock)
143144

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

tests/haskell-font-lock-tests.el

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
(insert line)
88
(insert "\n")))
99

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

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

430+
(ert-deftest haskell-syntactic-test-quasiquoter-sql-1 ()
431+
"Embedded SQL statements"
432+
(check-properties
433+
'("sql = [sql| SELECT title FROM books; |]")
434+
'(("SELECT" t font-lock-keyword-face)
435+
("title" t nil)
436+
("FROM" t font-lock-keyword-face)
437+
("books" t nil))))
438+
439+
(ert-deftest haskell-syntactic-test-quasiquoter-sql-2 ()
440+
"Embedded SQL statements"
441+
:expected-result :failed
442+
;; for now we have this problem that connstructor faces are used,
443+
;; org-mode knows how to get around this problem
444+
(check-properties
445+
'("sql = [sql| SELECT Title FROM Books; |]")
446+
'(("Title" t nil)
447+
("Books" t nil))))
448+
449+
427450
(ert-deftest haskell-syntactic-test-special-not-redefined ()
428451
"QuasiQuote should not conflict with TemplateHaskell"
429452
(check-properties

0 commit comments

Comments
 (0)