diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-11 14:40:20 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-12-11 14:40:20 +0100 |
commit | aa7e5ce651b1872180e8da94ac80fbc25e33eec0 (patch) | |
tree | d7a50705c11b9257683743857ea479b2d0739d1c /test | |
parent | 9d598ef93cbebe59f1d3a91f4fda35d3e00f36a9 (diff) | |
download | emacs-aa7e5ce651b1872180e8da94ac80fbc25e33eec0.tar.gz emacs-aa7e5ce651b1872180e8da94ac80fbc25e33eec0.tar.bz2 emacs-aa7e5ce651b1872180e8da94ac80fbc25e33eec0.zip |
Add new function `object-intervals'
* doc/lispref/text.texi (Examining Properties): Document it.
* src/fns.c (Fobject_intervals): New defun.
(collect_interval): New function.
Diffstat (limited to 'test')
-rw-r--r-- | test/src/fns-tests.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el index 86b8d655d26..14c0437d5f0 100644 --- a/test/src/fns-tests.el +++ b/test/src/fns-tests.el @@ -983,3 +983,19 @@ (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270") 2)) (should (equal (string-search "\303\270" "foo\303\270") 3))) + +(ert-deftest object-intervals () + (should (equal (object-intervals (propertize "foo" 'bar 'zot)) + ((0 3 (bar zot))))) + (should (equal (object-intervals (concat (propertize "foo" 'bar 'zot) + (propertize "foo" 'gazonk "gazonk"))) + ((0 3 (bar zot)) (3 6 (gazonk "gazonk"))))) + (should (equal + (with-temp-buffer + (insert "foobar") + (put-text-property 1 3 'foo 1) + (put-text-property 3 6 'bar 2) + (put-text-property 2 5 'zot 3) + (object-intervals (current-buffer))) + ((0 1 (foo 1)) (1 2 (zot 3 foo 1)) (2 4 (zot 3 bar 2)) + (4 5 (bar 2)) (5 6 nil))))) |