Add unit test for derivation parsing and output.
[jackhill/guix/guix.git] / tests / derivations.scm
CommitLineData
341c6fdd
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-derivations)
21 #:use-module (guix derivations)
22 #:use-module (srfi srfi-26)
23 #:use-module (srfi srfi-64)
24 #:use-module (rnrs io ports))
25
26(test-begin "derivations")
27
28(test-assert "parse & export"
29 (let* ((b1 (call-with-input-file "test.drv" get-bytevector-all))
30 (d1 (read-derivation (open-bytevector-input-port b1)))
31 (b2 (call-with-bytevector-output-port (cut write-derivation d1 <>)))
32 (d2 (read-derivation (open-bytevector-input-port b2))))
33 (and (equal? b1 b2)
34 (equal? d1 d2))))
35
36(test-end)
37
38\f
39(exit (= (test-runner-fail-count (test-runner-current)) 0))
40
41;;; Local Variables:
42;;; eval: (put 'test-assert 'scheme-indent-function 1)
43;;; End: