aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/ruby.scm
diff options
context:
space:
mode:
authorPhilip McGrath <philip@philipmcgrath.com>2022-07-25 08:16:34 -0400
committerLudovic Courtès <ludo@gnu.org>2022-08-04 12:05:52 +0200
commit9c124671ce0eafe50c1d913976ad6bc619475f9a (patch)
tree450aeaadb6332284496512ab905cb1f0c2372d93 /gnu/packages/ruby.scm
parent14a50b62d4e8765b794861226d79f6872d6c434c (diff)
downloadguix-9c124671ce0eafe50c1d913976ad6bc619475f9a.tar
guix-9c124671ce0eafe50c1d913976ad6bc619475f9a.tar.gz
gnu: anystyle: Add tests for dictionary adapters.
* gnu/packages/ruby.scm (anystyle)[arguments]: Instead of deleting the 'check' phase, replace it with a few tests. Add SRFI 1 to '#:modules'. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/ruby.scm')
-rw-r--r--gnu/packages/ruby.scm26
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 0b558de6db..2dba81c2a1 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -13613,6 +13613,7 @@ though the later has not yet been packaged for Guix.")
#:modules
`((guix build ruby-build-system)
(ice-9 popen)
+ (srfi srfi-1)
(guix build utils))
#:phases
#~(modify-phases %standard-phases
@@ -13621,7 +13622,30 @@ though the later has not yet been packaged for Guix.")
(substitute* "anystyle-cli.gemspec"
(("'bibtex-ruby', '[^']*'")
"'bibtex-ruby'"))))
- (delete 'check) ;; there are no upstream tests
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ ;; There are no tests, but let's use this opportunity to do a
+ ;; basic test of our own that things run ok. It works especially
+ ;; well to test this here since we know the 'ruby-anystile'
+ ;; package is in its final, immutable installed form.
+ (when tests?
+ (let ((common
+ `("require 'anystyle'"
+ ,(string-append
+ "pp AnyStyle.parse 'Derrida, J. (1967). L’écriture"
+ " et la différence (1 éd.). Paris: Éditions du"
+ " Seuil.'"))))
+ (for-each
+ (lambda (lines)
+ (apply invoke "ruby"
+ (fold-right (lambda (line lst)
+ (cons* "-e" line lst))
+ '()
+ lines)))
+ `(,common
+ ("require 'anystyle/dictionary'"
+ "AnyStyle::Dictionary.defaults[:adapter] = :gdbm"
+ ,@common)))))))
(add-after 'wrap 'check-cli
(lambda* (#:key tests? outputs #:allow-other-keys)
(when tests?