Skip to content
Merged
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
56 changes: 56 additions & 0 deletions tests/haskell-font-lock-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -866,3 +866,59 @@
("Y" t haskell-constructor-face)
("Z" t haskell-type-face)
("C" t haskell-constructor-face))))

(ert-deftest haskell-pattern ()
"Fontify the \"pattern\" keyword in contexts related to pattern synonyms."
:expected-result :failed
(check-properties
'("pattern A = B"
"pattern A <- B"
"pattern A ← B"
"pattern A n <- (subtract 1 -> n) where A n = n + 1"
"module Main (pattern A) where"
"pattern A :: a -> B"
"pattern A :: (C a) => a -> B"
"pattern A :: (C a) => a -> B"
"pattern A :: (C a) => () => a -> B"
"pattern A :: (C a) => () => a -> B"
"pattern A :: (C a) => (C a) => a -> B"
"pattern A :: (C a) => (C a) => a -> B")
'(("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("module" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("where" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face)
("pattern" t haskell-keyword-face))))

(ert-deftest haskell-no-pattern-1 ()
"Don't fontify \"pattern\" in contexts unrelated to pattern synonyms."
;; This already works properly
;;:expected-result :failed
(check-properties
'("pattern :: Int"
"pattern = 3")
'(("pattern" t haskell-definition-face)
("pattern" t haskell-definition-face))))

(ert-deftest haskell-no-pattern-2 ()
"Don't fontify \"pattern\" in contexts unrelated to pattern synonyms."
;; This already works properly
;;:expected-result :failed
(check-properties
'("foo :: (a -> pattern) -> a -> pattern"
"foo pattern x = pattern x"
"bar = pattern where pattern = 5")
'(("pattern" t nil)
("pattern" t nil)
("pattern" t nil)
("pattern" t nil)
("pattern" t nil)
("pattern" t nil))))