aboutsummaryrefslogtreecommitdiff
path: root/tests/mock-inferior.scm
blob: 28f020a994e53a77a2f11d543d05ca21bedf9ab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
(define-module (tests mock-inferior)
  #:use-module (guix records)
  #:use-module (guix tests)
  #:export (<mock-inferior-package>
            mock-inferior-package
            mock-inferior-package?
            mock-inferior-package-name
            mock-inferior-package-version
            mock-inferior-package-synopsis
            mock-inferior-package-description
            mock-inferior-package-home-page
            mock-inferior-package-location

            with-mock-inferior-packages))

(define-record-type* <mock-inferior-package>
  mock-inferior-package make-mock-inferior-pacakge
  mock-inferior-package?
  (name        mock-inferior-package-name)
  (version     mock-inferior-package-version)
  (synopsis    mock-inferior-package-synopsis)
  (description mock-inferior-package-description)
  (home-page   mock-inferior-package-home-page)
  (location    mock-inferior-package-location))

(define (with-mock-inferior-packages f)
  (mock
   ((guix inferior)
    %inferior-package-name-procedure    ; TODO This only sometimes works :(
    mock-inferior-package-name)
   (mock
    ((guix inferior)
     %inferior-package-version-procedure ; TODO This only sometimes works :(
     mock-inferior-package-version)
    (mock
     ((guix inferior)
      inferior-package-synopsis
      mock-inferior-package-synopsis)
     (mock
      ((guix inferior)
       inferior-package-description
       mock-inferior-package-description)
      (mock
       ((guix inferior)
        inferior-package-home-page
        mock-inferior-package-home-page)
       (mock
        ((guix inferior)
         inferior-package-location
         mock-inferior-package-location)
        (f))))))))