print.scm 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2017, 2020 Ricardo Wurmus <rekado@elephly.net>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU 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. ;;; GNU 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 GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (test-print)
  19. #:use-module (guix import print)
  20. #:use-module (guix build-system gnu)
  21. #:use-module (guix download)
  22. #:use-module (guix packages)
  23. #:use-module ((guix licenses) #:prefix license:)
  24. #:use-module (srfi srfi-64))
  25. (define-syntax-rule (define-with-source object source expr)
  26. (begin
  27. (define object expr)
  28. (define source 'expr)))
  29. (test-begin "print")
  30. (define-with-source pkg pkg-source
  31. (package
  32. (name "test")
  33. (version "1.2.3")
  34. (source (origin
  35. (method url-fetch)
  36. (uri (string-append "file:///tmp/test-"
  37. version ".tar.gz"))
  38. (sha256
  39. (base32
  40. "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
  41. (build-system (@ (guix build-system gnu) gnu-build-system))
  42. (home-page "http://gnu.org")
  43. (synopsis "Dummy")
  44. (description "This is a dummy package.")
  45. (license license:gpl3+)))
  46. (define-with-source pkg-with-inputs pkg-with-inputs-source
  47. (package
  48. (name "test")
  49. (version "1.2.3")
  50. (source (origin
  51. (method url-fetch)
  52. (uri (string-append "file:///tmp/test-"
  53. version ".tar.gz"))
  54. (sha256
  55. (base32
  56. "070pwb7brdcn1mfvplkd56vjc7lbz4iznzkqvfsakvgbv68k71ah"))))
  57. (build-system (@ (guix build-system gnu) gnu-build-system))
  58. (inputs (list (@ (gnu packages base) coreutils)
  59. `(,(@ (gnu packages base) glibc) "debug")))
  60. (home-page "http://gnu.org")
  61. (synopsis "Dummy")
  62. (description "This is a dummy package.")
  63. (license license:gpl3+)))
  64. (test-equal "simple package"
  65. `(define-public test ,pkg-source)
  66. (package->code pkg))
  67. (test-equal "package with inputs"
  68. `(define-public test ,pkg-with-inputs-source)
  69. (package->code pkg-with-inputs))
  70. (test-end "print")