Debian Codegraph @

test-suite/tests/copy-tree.test

raw
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
18 (define-module (test-suite test-copy-tree)
19 :use-module (test-suite lib)
20 :use-module (ice-9 copy-tree))
21
22 (with-test-prefix "copy-tree"
23 (pass-if "(#t . #(#t))"
24 (let* ((foo (cons #t (vector #t)))
25 (bar (copy-tree foo)))
26 (vector-set! (cdr foo) 0 #f)
27 (equal? bar '(#t . #(#t)))))
28
29 (pass-if-exception "circular lists in forms"
30 '(wrong-type-arg . "")
31 (let ((foo (list #f)))
32 (set-cdr! foo foo)
33 (copy-tree foo))))