| 1 |
|
| 2 |
|
| 3 |
exec guile --debug -e main -s "$0" "$@" |
| 4 |
!# |
| 5 |
|
| 6 |
;; guile-cairo unit test |
| 7 |
;; Copyright (C) 2007, 2011 Andy Wingo <wingo pobox.com> |
| 8 |
|
| 9 |
;; This program is free software; you can redistribute it and/or modify |
| 10 |
;; it under the terms of the GNU General Public License as published by |
| 11 |
;; the Free Software Foundation; either version 3 of the License, or (at |
| 12 |
;; your option) any later version. |
| 13 |
;; |
| 14 |
;; This program is distributed in the hope that it will be useful, but |
| 15 |
;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 |
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 17 |
;; General Public License for more details. |
| 18 |
;; |
| 19 |
;; You should have received a copy of the GNU General Public License |
| 20 |
;; along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 21 |
|
| 22 |
(use-modules (unit-test) |
| 23 |
(oop goops) |
| 24 |
(ice-9 pretty-print)) |
| 25 |
|
| 26 |
(define (module-all-uses module) |
| 27 |
(let ((direct (module-uses module))) |
| 28 |
(append direct |
| 29 |
(apply append (map module-all-uses direct))))) |
| 30 |
|
| 31 |
(define (module-exports module) |
| 32 |
(module-map (lambda (k v) k) module)) |
| 33 |
|
| 34 |
(define (module-all-exports module-name) |
| 35 |
(let ((interface (resolve-interface module-name))) |
| 36 |
(map |
| 37 |
string->symbol |
| 38 |
(sort |
| 39 |
(apply |
| 40 |
append |
| 41 |
(map |
| 42 |
(lambda (module) |
| 43 |
(map symbol->string (module-exports module))) |
| 44 |
(cons interface (module-all-uses interface)))) |
| 45 |
string<?)))) |
| 46 |
|
| 47 |
(define (main args) |
| 48 |
(pretty-print |
| 49 |
(module-all-exports (map string->symbol (cdr args))))) |