(should (equal a-dedup '("a" "b" "a" "b" "c")))
(should (eq a a-dedup))))
+(ert-deftest subr--safe-copy-tree ()
+ (should (null (safe-copy-tree nil)))
+ (let* ((foo '(1 2 (3 4))) (bar (safe-copy-tree foo)))
+ (should (equal bar foo))
+ (should-not (eq bar foo))
+ (should-not (eq (caddr bar) (caddr foo))))
+ (let* ((foo '#1=(a #1#)) (bar (safe-copy-tree foo)))
+ (should (eq (car bar) (car foo)))
+; (should-not (proper-list-p bar))
+ (should (eq (caadr bar) (caadr foo)))
+ (should (eq (caadr bar) 'a)))
+ (let* ((foo [1 2 3 4]) (bar (safe-copy-tree foo)))
+ (should (eq bar foo)))
+ (let* ((foo [1 (2 3) 4]) (bar (safe-copy-tree foo t)))
+ (should-not (eq bar foo))
+ (should (equal bar foo))
+ (should-not (eq (aref bar 1) (aref foo 1))))
+ (let* ((foo [1 [2 3] 4]) (bar (safe-copy-tree foo t)))
+ (should (equal bar foo))
+ (should-not (eq bar foo))
+ (should-not (eq (aref bar 1) (aref foo 1))))
+ (let* ((foo (record 'foo 1 "two" 3)) (bar (safe-copy-tree foo t)))
+ (should (equal bar foo))
+ (should-not (eq bar foo))
+ (should (eq (aref bar 2) (aref foo 2)))))
+
(provide 'subr-tests)
;;; subr-tests.el ends here