From 0d71b39097effd86d1788772b94eb95d2cc64639 Mon Sep 17 00:00:00 2001 From: Thomas Winant Date: Wed, 13 Jan 2016 15:10:51 +0100 Subject: [PATCH 1/3] Test that 'role' is only fontified after 'type' --- tests/haskell-font-lock-tests.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index 6bb43c599..d66b31c6a 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -556,9 +556,16 @@ if all of its characters have syntax and face. See 'literate)) (ert-deftest haskell-type-role () - "fontify \"role\" after \"type\"" + "Fontify \"role\" after \"type\"" (check-properties '("type role Ptr representational") '(("type" "w" haskell-keyword-face) ("role" "w" haskell-keyword-face) ("Ptr" "w" haskell-constructor-face)))) + +(ert-deftest haskell-no-type-role () + "Don't fontify \"role\" when not after \"type\"" + (check-properties + '("foo role = 3") + '(("foo" "w" haskell-definition-face) + ("role" "w" nil)))) From ad73e8f435ee151e2fd4df51c996ac4406782862 Mon Sep 17 00:00:00 2001 From: Thomas Winant Date: Wed, 13 Jan 2016 15:11:30 +0100 Subject: [PATCH 2/3] Test '{type|data} family' font-locking (#1056) --- tests/haskell-font-lock-tests.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index d66b31c6a..8f2c11c07 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -555,6 +555,27 @@ if all of its characters have syntax and face. See ("Comment3" t haskell-literate-comment-face)) 'literate)) +(ert-deftest haskell-type-family () + "Fontify \"family\" after \"type\"" + (check-properties + '("type family Foo a :: *") + '(("type" "w" haskell-keyword-face) + ("family" "w" haskell-keyword-face)))) + +(ert-deftest haskell-data-family () + "Fontify \"family\" after \"data\"" + (check-properties + '("data family Foo a :: *") + '(("data" "w" haskell-keyword-face) + ("family" "w" haskell-keyword-face)))) + +(ert-deftest haskell-no-family () + "Don't fontify \"family\" when not after \"type\" or \"data\"" + (check-properties + '("foo family = 10") + '(("foo" "w" haskell-definition-face) + ("family" "w" nil)))) + (ert-deftest haskell-type-role () "Fontify \"role\" after \"type\"" (check-properties From d8a066f484f37179872edb13f40bd63bc7052c4e Mon Sep 17 00:00:00 2001 From: Thomas Winant Date: Wed, 13 Jan 2016 15:15:35 +0100 Subject: [PATCH 3/3] Test 'type instance' font-locking --- tests/haskell-font-lock-tests.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/haskell-font-lock-tests.el b/tests/haskell-font-lock-tests.el index 8f2c11c07..f6780c6d7 100644 --- a/tests/haskell-font-lock-tests.el +++ b/tests/haskell-font-lock-tests.el @@ -555,6 +555,15 @@ if all of its characters have syntax and face. See ("Comment3" t haskell-literate-comment-face)) 'literate)) +(ert-deftest haskell-type-instance () + "Fontify \"instance\" after \"type\"" + ;; Note that instance is always fontified, because it is a keyword even + ;; without 'type' before it. + (check-properties + '("type instance Foo Int = Char") + '(("type" "w" haskell-keyword-face) + ("instance" "w" haskell-keyword-face)))) + (ert-deftest haskell-type-family () "Fontify \"family\" after \"type\"" (check-properties