diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2016-09-06 22:28:12 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2016-09-06 23:22:10 +0200 |
| commit | 5239f3d90841de767c86d0f3a7975b8d799d583d (patch) | |
| tree | 0b785fe2d906e867bf25002d82ce2d0f89c24504 /tests/packages.scm | |
| parent | c8c25704aeb2e5fa4feb6a86235f9565738eea99 (diff) | |
guix package: Build up the transaction incrementally.
* guix/scripts/package.scm (upgraded-manifest-entry): Rename to...
(transaction-upgrade-entry): ... this. Add 'transaction' parameter and
return a transaction.
(options->installable): Likewise.
[to-upgrade]: Rename to...
[upgraded]: ... this, and change to be a transaction. Return a
transaction.
(options->removable): Likewise.
(process-actions): Adjust accordingly.
* tests/packages.scm ("transaction-upgrade-entry, zero upgrades")
("transaction-upgrade-entry, one upgrade"): New tests.
Diffstat (limited to 'tests/packages.scm')
| -rw-r--r-- | tests/packages.scm | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index daceea5d62a..456e6919625 100644 --- a/tests/packages.scm +++ b/tests/packages.scm | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | #:use-module (srfi srfi-35) | 49 | #:use-module (srfi srfi-35) |
| 50 | #:use-module (srfi srfi-64) | 50 | #:use-module (srfi srfi-64) |
| 51 | #:use-module (rnrs io ports) | 51 | #:use-module (rnrs io ports) |
| 52 | #:use-module (ice-9 vlist) | ||
| 52 | #:use-module (ice-9 regex) | 53 | #:use-module (ice-9 regex) |
| 53 | #:use-module (ice-9 match)) | 54 | #:use-module (ice-9 match)) |
| 54 | 55 | ||
| @@ -83,6 +84,34 @@ | |||
| 83 | (and (hidden-package? (hidden-package (dummy-package "foo"))) | 84 | (and (hidden-package? (hidden-package (dummy-package "foo"))) |
| 84 | (not (hidden-package? (dummy-package "foo"))))) | 85 | (not (hidden-package? (dummy-package "foo"))))) |
| 85 | 86 | ||
| 87 | (test-assert "transaction-upgrade-entry, zero upgrades" | ||
| 88 | (let* ((old (dummy-package "foo" (version "1"))) | ||
| 89 | (tx (mock ((gnu packages) find-newest-available-packages | ||
| 90 | (const vlist-null)) | ||
| 91 | ((@@ (guix scripts package) transaction-upgrade-entry) | ||
| 92 | (manifest-entry | ||
| 93 | (inherit (package->manifest-entry old)) | ||
| 94 | (item (string-append (%store-prefix) "/" | ||
| 95 | (make-string 32 #\e) "-foo-1"))) | ||
| 96 | (manifest-transaction))))) | ||
| 97 | (manifest-transaction-null? tx))) | ||
| 98 | |||
| 99 | (test-assert "transaction-upgrade-entry, one upgrade" | ||
| 100 | (let* ((old (dummy-package "foo" (version "1"))) | ||
| 101 | (new (dummy-package "foo" (version "2"))) | ||
| 102 | (tx (mock ((gnu packages) find-newest-available-packages | ||
| 103 | (const (vhash-cons "foo" (list "2" new) vlist-null))) | ||
| 104 | ((@@ (guix scripts package) transaction-upgrade-entry) | ||
| 105 | (manifest-entry | ||
| 106 | (inherit (package->manifest-entry old)) | ||
| 107 | (item (string-append (%store-prefix) "/" | ||
| 108 | (make-string 32 #\e) "-foo-1"))) | ||
| 109 | (manifest-transaction))))) | ||
| 110 | (and (match (manifest-transaction-install tx) | ||
| 111 | ((($ <manifest-entry> "foo" "2" "out" item)) | ||
| 112 | (eq? item new))) | ||
| 113 | (null? (manifest-transaction-remove tx))))) | ||
| 114 | |||
| 86 | (test-assert "package-field-location" | 115 | (test-assert "package-field-location" |
| 87 | (let () | 116 | (let () |
| 88 | (define (goto port line column) | 117 | (define (goto port line column) |
