diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/automated/cl-lib.el | 19 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 338a825f51e..940ed0b0b91 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2014-04-20 Daniel Colascione <dancol@dancol.org> | ||
| 2 | |||
| 3 | * automated/cl-lib.el (cl-lib-struct-accessors,cl-the): New tests. | ||
| 4 | |||
| 1 | 2014-04-19 Michael Albinus <michael.albinus@gmx.de> | 5 | 2014-04-19 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 6 | ||
| 3 | * automated/tramp-tests.el (tramp--test-check-files): Extend test. | 7 | * automated/tramp-tests.el (tramp--test-check-files): Extend test. |
diff --git a/test/automated/cl-lib.el b/test/automated/cl-lib.el index f7f4314e1cb..a0df07e54ea 100644 --- a/test/automated/cl-lib.el +++ b/test/automated/cl-lib.el | |||
| @@ -201,4 +201,23 @@ | |||
| 201 | :b :a :a 42) | 201 | :b :a :a 42) |
| 202 | '(42 :a)))) | 202 | '(42 :a)))) |
| 203 | 203 | ||
| 204 | (ert-deftest cl-lib-struct-accessors () | ||
| 205 | (cl-defstruct mystruct (abc :readonly t) def) | ||
| 206 | (let ((x (make-mystruct :abc 1 :def 2))) | ||
| 207 | (should (eql (cl-struct-slot-value 'mystruct 'abc x) 1)) | ||
| 208 | (should (eql (cl-struct-slot-value 'mystruct 'def x) 2)) | ||
| 209 | (cl-struct-set-slot-value 'mystruct 'def x -1) | ||
| 210 | (should (eql (cl-struct-slot-value 'mystruct 'def x) -1)) | ||
| 211 | (should (eql (cl-struct-slot-offset 'mystruct 'abc) 1)) | ||
| 212 | (should-error (cl-struct-slot-offset 'mystruct 'marypoppins)) | ||
| 213 | (should (equal (cl-struct-slot-info 'mystruct) | ||
| 214 | '((cl-tag-slot) (abc :readonly t) (def)))))) | ||
| 215 | |||
| 216 | (ert-deftest cl-the () | ||
| 217 | (should (eql (the integer 42) 42)) | ||
| 218 | (should-error (the integer "abc")) | ||
| 219 | (let ((sideffect 0)) | ||
| 220 | (should (= (the integer (incf sideffect)) 1)) | ||
| 221 | (should (= sideffect 1)))) | ||
| 222 | |||
| 204 | ;;; cl-lib.el ends here | 223 | ;;; cl-lib.el ends here |