diff options
author | Christopher Baines <mail@cbaines.net> | 2019-05-12 16:58:56 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-05-12 17:32:37 +0100 |
commit | 0ab1c71722e81404972f80c91c9717e429d03ec3 (patch) | |
tree | 85cfa0cf33dcc6af848bbd92273f202c64f396d0 | |
parent | d2126820613a39be0a8724680e5e4e4ee38ddf84 (diff) | |
download | data-service-0ab1c71722e81404972f80c91c9717e429d03ec3.tar data-service-0ab1c71722e81404972f80c91c9717e429d03ec3.tar.gz |
Add a mock-inferior module
This to help test code which uses the (guix inferior) module.
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | tests/mock-inferior.scm | 45 |
2 files changed, 47 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index b0ab4ce..f9d6062 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,7 +57,8 @@ SOURCES = \ guix-data-service/web/query-parameters.scm \ guix-data-service/web/util.scm \ guix-data-service/web/view/html.scm \ - tests/driver.scm + tests/driver.scm \ + tests/mock-inferior.scm TEST_EXTENSIONS = .scm diff --git a/tests/mock-inferior.scm b/tests/mock-inferior.scm new file mode 100644 index 0000000..6424cd9 --- /dev/null +++ b/tests/mock-inferior.scm @@ -0,0 +1,45 @@ +(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 + + 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)) + +(define (with-mock-inferior-packages f) + (mock + ((guix inferior) + inferior-package-name + mock-inferior-package-name) + (mock + ((guix inferior) + inferior-package-version + 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) + (f))))))) |