bournish.scm 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. (define-module (test-bournish)
  20. #:use-module (guix build bournish)
  21. #:use-module (system base compile)
  22. #:use-module (system base language)
  23. #:use-module (srfi srfi-64))
  24. (test-begin "bournish")
  25. (test-equal "single statement"
  26. '(chdir "/foo")
  27. (read-and-compile (open-input-string "cd /foo")
  28. #:from %bournish-language #:to 'scheme))
  29. (test-equal "multiple statements"
  30. '(begin
  31. (chdir "/foo")
  32. (getcwd)
  33. ((@@ (guix build bournish) ls-command-implementation)))
  34. (read-and-compile (open-input-string "cd /foo\npwd\nls")
  35. #:from %bournish-language #:to 'scheme))
  36. (test-equal "rm"
  37. '(for-each delete-file (list "foo" "bar"))
  38. (read-and-compile (open-input-string "rm foo bar\n")
  39. #:from %bournish-language #:to 'scheme))
  40. (test-equal "rm -r"
  41. '(for-each (@ (guix build utils) delete-file-recursively)
  42. (list "/foo" "/bar"))
  43. (read-and-compile (open-input-string "rm -r /foo /bar\n")
  44. #:from %bournish-language #:to 'scheme))
  45. (test-end "bournish")