guile-jsonld/tests/coverage.scm.in

coverage.scm.in

1
#!@abs_top_srcdir@/pre-inst-env guile
2
!#
3
;;;; Copyright (C) 2020 Julien Lepiller <julien@lepiller.eu>
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 3 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
20
(use-modules (system vm coverage)
21
             (system vm vm))
22
(use-modules (test-modules online))
23
24
(define compact-test-url (string-append jsonld-test-url "compact-manifest.jsonld"))
25
(define expand-test-url (string-append jsonld-test-url "expand-manifest.jsonld"))
26
(define flatten-test-url (string-append jsonld-test-url "flatten-manifest.jsonld"))
27
(define remote-test-url (string-append jsonld-test-url "remote-doc-manifest.jsonld"))
28
29
(define (run-coverage)
30
  (let* ((currfile (dirname (current-filename)))
31
         (path (string-take currfile (string-rindex currfile #\/))))
32
    (add-to-load-path path))
33
  (call-with-values
34
    (lambda ()
35
      (with-code-coverage
36
        (lambda ()
37
          ;(run-test-suite (get-test-doc compact-test-url) '())
38
          ;(run-test-suite (get-test-doc expand-test-url) '())
39
          ;(run-test-suite (get-test-doc flatten-test-url) '())
40
          (run-test-suite (get-test-doc remote-test-url) '()))))
41
    (lambda (data result)
42
      (let ((port (open-output-file "lcov.info")))
43
        (coverage-data->lcov data port)
44
        (close port)))))
45
46
(run-coverage)
47