]> git.donarmstrong.com Git - lilypond.git/blob - guile18/test-suite/tests/srcprop.test
New upstream version 2.19.65
[lilypond.git] / guile18 / test-suite / tests / srcprop.test
1 ;;;; srcprop.test --- test Guile source properties    -*- scheme -*-
2 ;;;;
3 ;;;; Copyright (C) 2003, 2006 Free Software Foundation, Inc.
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
8 ;;;; version 2.1 of the License, or (at your option) any later version.
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
17 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
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
38 ;;;
39 ;;; set-source-properties!
40 ;;;
41
42 (with-test-prefix "set-source-properties!"
43   (read-enable 'positions)
44   (let ((s (read (open-input-string "(1 . 2)"))))
45     
46     (with-test-prefix "copied props"
47       (pass-if "visible to source-property"
48         (let ((t (cons 3 4)))
49           (set-source-properties! t (source-properties s))
50           (number? (source-property t 'line))))
51       
52       (pass-if "visible to source-properties"
53         (let ((t (cons 3 4)))
54           (set-source-properties! t (source-properties s))
55           (not (null? (source-properties t))))))))