copy-tree.test 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. ;;;; Copyright (C) 2000-2001,2003-2015,2017,2019,2020
  2. ;;;; Free Software Foundation, Inc.
  3. ;;;;
  4. ;;;; This library is free software; you can redistribute it and/or
  5. ;;;; modify it under the terms of the GNU Lesser General Public
  6. ;;;; License as published by the Free Software Foundation; either
  7. ;;;; version 3 of the License, or (at your option) any later version.
  8. ;;;;
  9. ;;;; This library is distributed in the hope that it will be useful,
  10. ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. ;;;; Lesser General Public License for more details.
  13. ;;;;
  14. ;;;; You should have received a copy of the GNU Lesser General Public
  15. ;;;; License along with this library; if not, write to the Free Software
  16. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. (define-module (test-suite test-copy-tree)
  18. :use-module (test-suite lib)
  19. :use-module (ice-9 copy-tree))
  20. (with-test-prefix "copy-tree"
  21. (pass-if "(#t . #(#t))"
  22. (let* ((foo (cons #t (vector #t)))
  23. (bar (copy-tree foo)))
  24. (vector-set! (cdr foo) 0 #f)
  25. (equal? bar '(#t . #(#t)))))
  26. (pass-if-exception "circular lists in forms"
  27. '(wrong-type-arg . "")
  28. (let ((foo (list #f)))
  29. (set-cdr! foo foo)
  30. (copy-tree foo))))