tvl-depot/users/wpcarro/emacs/pkgs/struct/tests.el
William Carroll 77aeb57c64 fix(wpcarro/emacs): Use should macro in struct.el tests
:)

Change-Id: Ia6b4697d002394a7e1d913031849b383ed424ad5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6013
Reviewed-by: wpcarro <wpcarro@gmail.com>
Autosubmit: wpcarro <wpcarro@gmail.com>
Tested-by: BuildkiteCI
2022-07-30 14:28:39 +00:00

24 lines
961 B
EmacsLisp

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'ert)
(require 'dash)
(require 'struct)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Tests
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(ert-deftest struct-set! ()
(cl-defstruct dummy name age)
(defvar struct--test-dummy (make-dummy :name "Roofus" :age 19))
(struct-set! dummy name "Doofus" struct--test-dummy)
(should (string= "Doofus" (dummy-name struct--test-dummy))))
(ert-deftest struct-set ()
(cl-defstruct dummy name age)
(defvar struct--test-dummy (make-dummy :name "Roofus" :age 19))
(let ((result (struct-set dummy name "Shoofus" struct--test-dummy)))
(should (string= "Roofus" (dummy-name struct--test-dummy)))
(should (string= "Shoofus" (dummy-name result)))))