diff options
author | Wilfred Hughes <me@wilfred.me.uk> | 2016-07-10 21:31:51 +0100 |
---|---|---|
committer | Wilfred Hughes <me@wilfred.me.uk> | 2016-07-10 21:32:41 +0100 |
commit | fa79465d5e21ecf5c9e85d6886123aafa513fffd (patch) | |
tree | 0f448bbe853d2020609720f092a6140cbe73534a /dev | |
parent | 2184337a132944f669144d0078d1fa1220012840 (diff) |
Preserve text properties.
If we're given a string with properties, ensure the output has the same
properties.
Diffstat (limited to 'dev')
-rw-r--r-- | dev/examples-to-tests.el | 2 | ||||
-rw-r--r-- | dev/examples.el | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/dev/examples-to-tests.el b/dev/examples-to-tests.el index bbed66b..57db6cc 100644 --- a/dev/examples-to-tests.el +++ b/dev/examples-to-tests.el @@ -3,7 +3,7 @@ (defun examples-to-should-1 (examples) (let ((actual (car examples)) (expected (cadr (cdr examples)))) - `(should (equal ,actual ,expected)))) + `(should (equal-including-properties ,actual ,expected)))) (defun examples-to-should (examples) (let (result) diff --git a/dev/examples.el b/dev/examples.el index 0cd1f40..b295ec7 100644 --- a/dev/examples.el +++ b/dev/examples.el @@ -32,7 +32,8 @@ (defexamples s-word-wrap (s-word-wrap 10 "This is too long") => "This is\ntoo long" (s-word-wrap 10 "This is way way too long") => "This is\nway way\ntoo long" - (s-word-wrap 10 "It-wraps-words-but-does-not-break-them") => "It-wraps-words-but-does-not-break-them") + (s-word-wrap 10 "It-wraps-words-but-does-not-break-them") => "It-wraps-words-but-does-not-break-them" + (s-word-wrap 100 (propertize "foo bar" 'face 'font-lock-keyword-face)) => (propertize "foo bar" 'face 'font-lock-keyword-face)) (defexamples s-center (s-center 5 "a") => " a " @@ -171,7 +172,8 @@ (s-split-up-to "|" "foo||bar|baz|qux" 10 t) => '("foo" "bar" "baz" "qux") (s-split-up-to "|" "foo|bar|baz|" 2) => '("foo" "bar" "baz|") (s-split-up-to "|" "foo|bar|baz|" 2 t) => '("foo" "bar" "baz|") - (s-split-up-to "|" "foo|bar|baz|qux|" 2) => '("foo" "bar" "baz|qux|")) + (s-split-up-to "|" "foo|bar|baz|qux|" 2) => '("foo" "bar" "baz|qux|") + (s-split-up-to "|" (propertize "foo" 'face 'font-lock-keyword-face) 1) => (list (propertize "foo" 'face 'font-lock-keyword-face))) (defexamples s-join (s-join "+" '("abc" "def" "ghi")) => "abc+def+ghi" |