diff options
| author | Lars Ingebrigtsen | 2020-12-11 14:40:20 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-11 14:40:20 +0100 |
| commit | aa7e5ce651b1872180e8da94ac80fbc25e33eec0 (patch) | |
| tree | d7a50705c11b9257683743857ea479b2d0739d1c /test/src | |
| parent | 9d598ef93cbebe59f1d3a91f4fda35d3e00f36a9 (diff) | |
| download | emacs-aa7e5ce651b1872180e8da94ac80fbc25e33eec0.tar.gz 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/src')
| -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 @@ | |||
| 983 | (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270") | 983 | (should (equal (string-search (string-to-multibyte "o\303\270") "foo\303\270") |
| 984 | 2)) | 984 | 2)) |
| 985 | (should (equal (string-search "\303\270" "foo\303\270") 3))) | 985 | (should (equal (string-search "\303\270" "foo\303\270") 3))) |
| 986 | |||
| 987 | (ert-deftest object-intervals () | ||
| 988 | (should (equal (object-intervals (propertize "foo" 'bar 'zot)) | ||
| 989 | ((0 3 (bar zot))))) | ||
| 990 | (should (equal (object-intervals (concat (propertize "foo" 'bar 'zot) | ||
| 991 | (propertize "foo" 'gazonk "gazonk"))) | ||
| 992 | ((0 3 (bar zot)) (3 6 (gazonk "gazonk"))))) | ||
| 993 | (should (equal | ||
| 994 | (with-temp-buffer | ||
| 995 | (insert "foobar") | ||
| 996 | (put-text-property 1 3 'foo 1) | ||
| 997 | (put-text-property 3 6 'bar 2) | ||
| 998 | (put-text-property 2 5 'zot 3) | ||
| 999 | (object-intervals (current-buffer))) | ||
| 1000 | ((0 1 (foo 1)) (1 2 (zot 3 foo 1)) (2 4 (zot 3 bar 2)) | ||
| 1001 | (4 5 (bar 2)) (5 6 nil))))) | ||