| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org> |
| 3 | ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net> |
| 4 | ;;; |
| 5 | ;;; This file is part of GNU Guix. |
| 6 | ;;; |
| 7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 8 | ;;; under the terms of the GNU General Public License as published by |
| 9 | ;;; the Free Software Foundation; either version 3 of the License, or (at |
| 10 | ;;; your option) any later version. |
| 11 | ;;; |
| 12 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
| 13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | ;;; GNU General Public License for more details. |
| 16 | ;;; |
| 17 | ;;; You should have received a copy of the GNU General Public License |
| 18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | (define-module (test-bournish) |
| 21 | #:use-module (guix build bournish) |
| 22 | #:use-module (system base compile) |
| 23 | #:use-module (system base language) |
| 24 | #:use-module (srfi srfi-64)) |
| 25 | |
| 26 | \f |
| 27 | (test-begin "bournish") |
| 28 | |
| 29 | (test-equal "single statement" |
| 30 | '(chdir "/foo") |
| 31 | (read-and-compile (open-input-string "cd /foo") |
| 32 | #:from %bournish-language #:to 'scheme)) |
| 33 | |
| 34 | (test-equal "multiple statements" |
| 35 | '(begin |
| 36 | (chdir "/foo") |
| 37 | (getcwd) |
| 38 | ((@@ (guix build bournish) ls-command-implementation))) |
| 39 | (read-and-compile (open-input-string "cd /foo\npwd\nls") |
| 40 | #:from %bournish-language #:to 'scheme)) |
| 41 | |
| 42 | (test-equal "rm" |
| 43 | '(for-each delete-file (list "foo" "bar")) |
| 44 | (read-and-compile (open-input-string "rm foo bar\n") |
| 45 | #:from %bournish-language #:to 'scheme)) |
| 46 | |
| 47 | (test-equal "rm -r" |
| 48 | '(for-each (@ (guix build utils) delete-file-recursively) |
| 49 | (list "/foo" "/bar")) |
| 50 | (read-and-compile (open-input-string "rm -r /foo /bar\n") |
| 51 | #:from %bournish-language #:to 'scheme)) |
| 52 | |
| 53 | (test-end "bournish") |
| 54 | |