aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPrzemysław Wojnowski2015-11-08 19:19:15 +0100
committerNicolas Petton2015-11-20 00:19:56 +0100
commit5c81fd58e32d965c2551663622e084f2800e1e90 (patch)
tree2dfaabcf1cddc4b4c370ef61f7c8b5e4d48bddae /test
parentebad964b3afbe5ef77085be94cf566836450c74c (diff)
downloademacs-5c81fd58e32d965c2551663622e084f2800e1e90.tar.gz
emacs-5c81fd58e32d965c2551663622e084f2800e1e90.zip
Use obarray functions from obarray.
* lisp/abbrev.el (copy-abbrev-table, abbrev-table-p, make-abbrev-table, abbrev-table-get, abbrev-table-put, abbrev-table-empty-p, clear-abbrev-table, define-abbrev, abbrev--symbol, abbrev-table-menu): delegate to obarray.el functions. * lisp/loadup.el: load obarray before abbrev * test/automated/abbrev-tests.el: new tests
Diffstat (limited to 'test')
-rw-r--r--test/automated/abbrev-tests.el35
1 files changed, 33 insertions, 2 deletions
diff --git a/test/automated/abbrev-tests.el b/test/automated/abbrev-tests.el
index d08e026ac59..17aea5d0f82 100644
--- a/test/automated/abbrev-tests.el
+++ b/test/automated/abbrev-tests.el
@@ -1,4 +1,4 @@
1;;; abbrev-tests.el --- Test suite for abbrevs. 1;;; abbrev-tests.el --- Test suite for abbrevs -*- lexical-binding: t; -*-
2 2
3;; Copyright (C) 2015 Free Software Foundation, Inc. 3;; Copyright (C) 2015 Free Software Foundation, Inc.
4 4
@@ -20,11 +20,43 @@
20;; You should have received a copy of the GNU General Public License 20;; You should have received a copy of the GNU General Public License
21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 21;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 22
23;;; Commentary:
24
23;;; Code: 25;;; Code:
24 26
25(require 'ert) 27(require 'ert)
26(require 'abbrev) 28(require 'abbrev)
27 29
30(ert-deftest abbrev-table-p-test ()
31 (should-not (abbrev-table-p 42))
32 (should-not (abbrev-table-p "aoeu"))
33 (should-not (abbrev-table-p '()))
34 (should-not (abbrev-table-p []))
35 ;; Missing :abbrev-table-modiff counter:
36 (should-not (abbrev-table-p (obarray-make)))
37 (let* ((table (obarray-make)))
38 (abbrev-table-put table :abbrev-table-modiff 42)
39 (should (abbrev-table-p table))))
40
41(ert-deftest abbrev-make-abbrev-table-test ()
42 ;; Table without properties:
43 (let ((table (make-abbrev-table)))
44 (should (abbrev-table-p table))
45 (should (= (length table) obarray-default-size)))
46 ;; Table with one property 'foo with value 'bar:
47 (let ((table (make-abbrev-table '(foo bar))))
48 (should (abbrev-table-p table))
49 (should (= (length table) obarray-default-size))
50 (should (eq (abbrev-table-get table 'foo) 'bar))))
51
52(ert-deftest abbrev-table-get-put-test ()
53 (let ((table (make-abbrev-table)))
54 (should-not (abbrev-table-get table 'foo))
55 (should (= (abbrev-table-put table 'foo 42) 42))
56 (should (= (abbrev-table-get table 'foo) 42))
57 (should (eq (abbrev-table-put table 'foo 'bar) 'bar))
58 (should (eq (abbrev-table-get table 'foo) 'bar))))
59
28(ert-deftest copy-abbrev-table-test () 60(ert-deftest copy-abbrev-table-test ()
29 (defvar foo-abbrev-table nil) ; Avoid compiler warning 61 (defvar foo-abbrev-table nil) ; Avoid compiler warning
30 (define-abbrev-table 'foo-abbrev-table 62 (define-abbrev-table 'foo-abbrev-table
@@ -39,5 +71,4 @@
39 (should-not (string-equal (buffer-name) "*Backtrace*"))) 71 (should-not (string-equal (buffer-name) "*Backtrace*")))
40 72
41(provide 'abbrev-tests) 73(provide 'abbrev-tests)
42
43;;; abbrev-tests.el ends here 74;;; abbrev-tests.el ends here