merge from 1.8 branch
[bpt/guile.git] / test-suite / tests / srfi-17.test
CommitLineData
7171f1ab
DH
1;;;; srfi-17.test --- test suite for Guile's SRFI-17 functions. -*- scheme -*-
2;;;;
6e7d5622 3;;;; Copyright (C) 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
7171f1ab
DH
4;;;;
5;;;; This program is free software; you can redistribute it and/or modify
6;;;; it under the terms of the GNU General Public License as published by
7;;;; the Free Software Foundation; either version 2, or (at your option)
8;;;; any later version.
9;;;;
10;;;; This program is distributed in the hope that it will be useful,
11;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13;;;; GNU General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU General Public License
16;;;; along with this software; see the file COPYING. If not, write to
92205699
MV
17;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18;;;; Boston, MA 02110-1301 USA
7171f1ab 19
d6e04e7c
DH
20(define-module (test-suite test-srfi-17)
21 :use-module (test-suite lib)
22 :use-module (srfi srfi-17))
23
7171f1ab 24
3c1f825c
KR
25(pass-if "cond-expand srfi-17"
26 (cond-expand (srfi-17 #t)
27 (else #f)))
28
29;;
30;; car
31;;
32
33(with-test-prefix "car"
34
35 (pass-if "set! (car x)"
36 (let ((lst (list 1)))
37 (set! (car lst) 2)
38 (eqv? 2 (car lst)))))
39
40;;
41;; set!
42;;
43
7171f1ab
DH
44(with-test-prefix "set!"
45
46 (with-test-prefix "target is not procedure with setter"
47
48 (pass-if-exception "(set! (symbol->string 'x) 1)"
49 exception:wrong-type-arg
50 (set! (symbol->string 'x) 1))
51
52 (pass-if-exception "(set! '#f 1)"
64daa012 53 exception:bad-variable
d6e04e7c 54 (eval '(set! '#f 1) (interaction-environment)))))
3c1f825c
KR
55
56;;
57;; setter
58;;
59
60(with-test-prefix "setter"
61
62 (pass-if-exception "set! (setter x)" (cons 'misc-error ".*")
63 (set! (setter car) noop))
64
65 (pass-if "car"
66 (eq? set-car! (setter car))))