Skip to content

Commit 0dcf996

Browse files
committed
Merge pull request #1070 from mrBliss/more-font-lock-tests
More font lock tests
2 parents 4f97247 + d8a066f commit 0dcf996

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

tests/haskell-font-lock-tests.el

+38-1
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,47 @@ if all of its characters have syntax and face. See
555555
("Comment3" t haskell-literate-comment-face))
556556
'literate))
557557

558+
(ert-deftest haskell-type-instance ()
559+
"Fontify \"instance\" after \"type\""
560+
;; Note that instance is always fontified, because it is a keyword even
561+
;; without 'type' before it.
562+
(check-properties
563+
'("type instance Foo Int = Char")
564+
'(("type" "w" haskell-keyword-face)
565+
("instance" "w" haskell-keyword-face))))
566+
567+
(ert-deftest haskell-type-family ()
568+
"Fontify \"family\" after \"type\""
569+
(check-properties
570+
'("type family Foo a :: *")
571+
'(("type" "w" haskell-keyword-face)
572+
("family" "w" haskell-keyword-face))))
573+
574+
(ert-deftest haskell-data-family ()
575+
"Fontify \"family\" after \"data\""
576+
(check-properties
577+
'("data family Foo a :: *")
578+
'(("data" "w" haskell-keyword-face)
579+
("family" "w" haskell-keyword-face))))
580+
581+
(ert-deftest haskell-no-family ()
582+
"Don't fontify \"family\" when not after \"type\" or \"data\""
583+
(check-properties
584+
'("foo family = 10")
585+
'(("foo" "w" haskell-definition-face)
586+
("family" "w" nil))))
587+
558588
(ert-deftest haskell-type-role ()
559-
"fontify \"role\" after \"type\""
589+
"Fontify \"role\" after \"type\""
560590
(check-properties
561591
'("type role Ptr representational")
562592
'(("type" "w" haskell-keyword-face)
563593
("role" "w" haskell-keyword-face)
564594
("Ptr" "w" haskell-constructor-face))))
595+
596+
(ert-deftest haskell-no-type-role ()
597+
"Don't fontify \"role\" when not after \"type\""
598+
(check-properties
599+
'("foo role = 3")
600+
'(("foo" "w" haskell-definition-face)
601+
("role" "w" nil))))

0 commit comments

Comments
 (0)