aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp/textmodes/css-mode-tests.el
diff options
context:
space:
mode:
authorSimen Heggestøyl2016-04-24 19:57:42 +0200
committerSimen Heggestøyl2016-04-24 19:58:36 +0200
commite6d6a99455183bca5074b7601ad11d424da6442e (patch)
tree37d78fa65347b299f1fad95520ae9e5959220529 /test/lisp/textmodes/css-mode-tests.el
parent12846626bfae795a173fdedf2850dfbd24065534 (diff)
downloademacs-e6d6a99455183bca5074b7601ad11d424da6442e.tar.gz
emacs-e6d6a99455183bca5074b7601ad11d424da6442e.zip
Don't let `css--property-values' return duplicates
* lisp/textmodes/css-mode.el (css--property-values): Don't return duplicate values. * test/lisp/textmodes/css-mode-tests.el (css-test-property-values): Take the above into account. (css-test-property-values-no-duplicates): Test that duplicates aren't returned by `css--property-values'.
Diffstat (limited to 'test/lisp/textmodes/css-mode-tests.el')
-rw-r--r--test/lisp/textmodes/css-mode-tests.el18
1 files changed, 14 insertions, 4 deletions
diff --git a/test/lisp/textmodes/css-mode-tests.el b/test/lisp/textmodes/css-mode-tests.el
index 805364c9f42..5d5873b301b 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -24,8 +24,9 @@
24 24
25;;; Code: 25;;; Code:
26 26
27(require 'ert)
28(require 'css-mode) 27(require 'css-mode)
28(require 'ert)
29(require 'seq)
29 30
30(ert-deftest css-test-property-values () 31(ert-deftest css-test-property-values ()
31 ;; The `float' property has a flat value list. 32 ;; The `float' property has a flat value list.
@@ -36,9 +37,10 @@
36 ;; The `list-style' property refers to several other properties. 37 ;; The `list-style' property refers to several other properties.
37 (should 38 (should
38 (equal (sort (css--property-values "list-style") #'string-lessp) 39 (equal (sort (css--property-values "list-style") #'string-lessp)
39 (sort (append (css--property-values "list-style-type") 40 (sort (seq-uniq
40 (css--property-values "list-style-position") 41 (append (css--property-values "list-style-type")
41 (css--property-values "list-style-image")) 42 (css--property-values "list-style-position")
43 (css--property-values "list-style-image")))
42 #'string-lessp))) 44 #'string-lessp)))
43 45
44 ;; The `position' property is tricky because it's also the name of a 46 ;; The `position' property is tricky because it's also the name of a
@@ -64,6 +66,14 @@
64 (should (equal (gethash "word-wrap" css--property-value-cache) 66 (should (equal (gethash "word-wrap" css--property-value-cache)
65 word-wrap-values)))) 67 word-wrap-values))))
66 68
69(ert-deftest css-test-property-values-no-duplicates ()
70 "Test that `css--property-values' returns no duplicates."
71 ;; The `flex' property is prone to duplicate values; if they aren't
72 ;; removed, it'll contain at least two instances of `auto'.
73 (should
74 (equal (sort (css--property-values "flex") #'string-lessp)
75 '("auto" "content" "none"))))
76
67(ert-deftest css-test-value-class-lookup () 77(ert-deftest css-test-value-class-lookup ()
68 (should 78 (should
69 (equal (sort (css--value-class-lookup 'position) #'string-lessp) 79 (equal (sort (css--value-class-lookup 'position) #'string-lessp)