Merge commit 'a7bbba05838cabe2294f498e7008e1c51db6d664'
[bpt/guile.git] / test-suite / tests / eval-string.test
CommitLineData
d59dd06e
AW
1;;;; eval-string.test --- tests for (ice-9 eval-string) -*- scheme -*-
2;;;; Copyright (C) 2011 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-eval-string)
19 #:use-module (test-suite lib)
20 #:use-module (ice-9 eval-string))
21
22
23(with-test-prefix "basic"
24 (pass-if "eval none"
25 (equal? (eval-string "") *unspecified*))
26
27 (pass-if "eval single"
28 (equal? (eval-string "'foo") 'foo))
29
30 (pass-if "eval multiple"
31 (equal? (eval-string "'foo 'bar") 'bar))
32
33 (pass-if "compile none"
34 (equal? (eval-string "" #:compile? #t) *unspecified*))
35
36 (pass-if "compile single"
37 (equal? (eval-string "'foo" #:compile? #t)
38 'foo))
39
40 (pass-if "compile multiple"
41 (equal? (eval-string "'foo 'bar" #:compile? #t)
42 'bar))
43
44 (pass-if "eval values"
45 (equal? (call-with-values (lambda ()
46 (eval-string "(values 1 2)"))
47 list)
48 '(1 2)))
49
50 (pass-if "compile values"
51 (equal? (call-with-values (lambda ()
52 (eval-string "(values 1 2)" #:compile? #t))
53 list)
54 '(1 2))))