summaryrefslogtreecommitdiff
path: root/test/lisp/emacs-lisp/memory-report-tests.el
diff options
context:
space:
mode:
authorYikai Zhao <yikai@z1k.dev>2021-09-02 09:37:06 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2021-09-02 09:37:06 +0200
commitd8d5dc45656233fdccc3709093a16e2562cd4a40 (patch)
tree50c4932d2b6c6f9778ece51be56ffb3083bdae41 /test/lisp/emacs-lisp/memory-report-tests.el
parent891be6f14065950465bf6e360013ceae0cb955bd (diff)
downloademacs-d8d5dc45656233fdccc3709093a16e2562cd4a40.tar.gz
emacs-d8d5dc45656233fdccc3709093a16e2562cd4a40.tar.bz2
emacs-d8d5dc45656233fdccc3709093a16e2562cd4a40.zip
memory-report: support calculating size for structures
* lisp/emacs-lisp/memory-report.el (memory-report--object-size-1): Add support for cl-defstruct types (bug#50301).
Diffstat (limited to 'test/lisp/emacs-lisp/memory-report-tests.el')
-rw-r--r--test/lisp/emacs-lisp/memory-report-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/memory-report-tests.el b/test/lisp/emacs-lisp/memory-report-tests.el
index 0c0297b5fce..e352dd165f3 100644
--- a/test/lisp/emacs-lisp/memory-report-tests.el
+++ b/test/lisp/emacs-lisp/memory-report-tests.el
@@ -68,6 +68,14 @@
(vector string string))
124))))
+(ert-deftest memory-report-sizes-structs ()
+ (cl-defstruct memory-report-test-struct
+ (item0 nil)
+ (item1 nil))
+ (let ((s (make-memory-report-test-struct :item0 "hello" :item1 "world")))
+ (should (= (memory-report-object-size s)
+ 90))))
+
(provide 'memory-report-tests)
;;; memory-report-tests.el ends here