Commit | Line | Data |
---|---|---|
b0e0d0e9 LC |
1 | ;;; Guix --- Nix package management from Guile. -*- coding: utf-8 -*- |
2 | ;;; Copyright (C) 2012 Ludovic Courtès <ludo@gnu.org> | |
3 | ;;; | |
4 | ;;; This file is part of Guix. | |
5 | ;;; | |
6 | ;;; Guix is free software; you can redistribute it and/or modify it | |
7 | ;;; under the terms of the GNU General Public License as published by | |
8 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
9 | ;;; your option) any later version. | |
10 | ;;; | |
11 | ;;; Guix is distributed in the hope that it will be useful, but | |
12 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | ;;; GNU General Public License for more details. | |
15 | ;;; | |
16 | ;;; You should have received a copy of the GNU General Public License | |
17 | ;;; along with Guix. If not, see <http://www.gnu.org/licenses/>. | |
18 | ||
19 | ||
20 | (define-module (test-build-utils) | |
21 | #:use-module (guix build utils) | |
22 | #:use-module (srfi srfi-64)) | |
23 | ||
24 | (test-begin "build-utils") | |
25 | ||
26 | (test-equal "alist-cons-before" | |
27 | '((a . 1) (x . 42) (b . 2) (c . 3)) | |
28 | (alist-cons-before 'b 'x 42 '((a . 1) (b . 2) (c . 3)))) | |
29 | ||
30 | (test-equal "alist-cons-before, reference not found" | |
31 | '((a . 1) (b . 2) (c . 3) (x . 42)) | |
32 | (alist-cons-before 'z 'x 42 '((a . 1) (b . 2) (c . 3)))) | |
33 | ||
34 | (test-equal "alist-cons-after" | |
35 | '((a . 1) (b . 2) (x . 42) (c . 3)) | |
36 | (alist-cons-after 'b 'x 42 '((a . 1) (b . 2) (c . 3)))) | |
37 | ||
38 | (test-equal "alist-cons-after, reference not found" | |
39 | '((a . 1) (b . 2) (c . 3) (x . 42)) | |
40 | (alist-cons-after 'z 'x 42 '((a . 1) (b . 2) (c . 3)))) | |
41 | ||
42 | (test-equal "alist-replace" | |
43 | '((a . 1) (b . 77) (c . 3)) | |
44 | (alist-replace 'b 77 '((a . 1) (b . 2) (c . 3)))) | |
45 | ||
46 | (test-assert "alist-replace, key not found" | |
47 | (not (false-if-exception | |
48 | (alist-replace 'z 77 '((a . 1) (b . 2) (c . 3)))))) | |
49 | ||
50 | (test-end) | |
51 | ||
52 | \f | |
53 | (exit (= (test-runner-fail-count (test-runner-current)) 0)) | |
54 | ||
55 | ;;; Local Variables: | |
56 | ;;; eval: (put 'test-assert 'scheme-indent-function 1) | |
57 | ;;; eval: (put 'test-equal 'scheme-indent-function 1) | |
58 | ;;; End: |