Remove locale u8vector functions
[bpt/guile.git] / test-suite / tests / srcprop.test
CommitLineData
496660d0
KR
1;;;; srcprop.test --- test Guile source properties -*- scheme -*-
2;;;;
6e7d5622 3;;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc.
496660d0
KR
4;;;;
5;;;; This library is free software; you can redistribute it and/or
6;;;; modify it under the terms of the GNU Lesser General Public
7;;;; License as published by the Free Software Foundation; either
53befeb7 8;;;; version 3 of the License, or (at your option) any later version.
496660d0
KR
9;;;;
10;;;; This library 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 GNU
13;;;; Lesser General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU Lesser General Public
16;;;; License along with this library; if not, write to the Free Software
92205699 17;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
496660d0
KR
18
19(define-module (test-suite test-srcprop)
20 :use-module (test-suite lib))
21
22
23;;;
24;;; source-properties
25;;;
26
27(with-test-prefix "source-properties"
28
29 (pass-if "no props"
30 (null? (source-properties (list 1 2 3))))
31
32 (read-enable 'positions)
33 (let ((s (read (open-input-string "(1 . 2)"))))
34
35 (pass-if "read properties"
36 (not (null? (source-properties s))))))
37
1b872adf
NJ
38;;;
39;;; set-source-property!
40;;;
41
42(with-test-prefix "set-source-property!"
43 (read-enable 'positions)
44
45 (pass-if "setting the breakpoint property works"
46 (let ((s (read (open-input-string "(+ 3 4)"))))
47 (set-source-property! s 'breakpoint #t)
48 (let ((current-trap-opts (evaluator-traps-interface))
49 (current-debug-opts (debug-options-interface))
50 (trap-called #f))
51 (trap-set! enter-frame-handler (lambda _ (set! trap-called #t)))
52 (trap-enable 'traps)
53 (debug-enable 'debug)
54 (debug-enable 'breakpoints)
55 (with-traps (lambda ()
56 (primitive-eval s)))
57 (evaluator-traps-interface current-trap-opts)
58 (debug-options-interface current-debug-opts)
59 trap-called))))
60
496660d0
KR
61;;;
62;;; set-source-properties!
63;;;
64
65(with-test-prefix "set-source-properties!"
66 (read-enable 'positions)
1b872adf
NJ
67
68 (pass-if "setting the breakpoint property works"
69 (let ((s (read (open-input-string "(+ 3 4)"))))
70 (set-source-properties! s '((breakpoint #t)))
71 (let ((current-trap-opts (evaluator-traps-interface))
72 (current-debug-opts (debug-options-interface))
73 (trap-called #f))
74 (trap-set! enter-frame-handler (lambda _ (set! trap-called #t)))
75 (trap-enable 'traps)
76 (debug-enable 'debug)
77 (debug-enable 'breakpoints)
78 (with-traps (lambda ()
79 (primitive-eval s)))
80 (evaluator-traps-interface current-trap-opts)
81 (debug-options-interface current-debug-opts)
82 trap-called)))
83
496660d0
KR
84 (let ((s (read (open-input-string "(1 . 2)"))))
85
86 (with-test-prefix "copied props"
87 (pass-if "visible to source-property"
88 (let ((t (cons 3 4)))
89 (set-source-properties! t (source-properties s))
90 (number? (source-property t 'line))))
1b872adf 91
496660d0
KR
92 (pass-if "visible to source-properties"
93 (let ((t (cons 3 4)))
94 (set-source-properties! t (source-properties s))
95 (not (null? (source-properties t))))))))