import/cran: Detect library references in "check_installed".

* guix/import/cran.scm (import-pattern): Add case for "check_installed".
* tests/import/cran.scm: Add test.

Change-Id: Id69371158eecaeb371056e6954a3109687346c22
This commit is contained in:
Ricardo Wurmus 2025-11-19 15:50:32 +01:00
parent ad87b718ed
commit b215cb2027
No known key found for this signature in database
GPG key ID: 197A5888235FACAC
2 changed files with 6 additions and 1 deletions

View file

@ -570,7 +570,7 @@ referenced in build system files."
;; Quiet imports
"(suppressPackageStartupMessages\\()?"
;; the actual import statement.
"(require|library)\\(\"?([^, \")]+)"
"(require|library|check_installed)\\(\"?([^, \")]+)"
;; Or perhaps...
"|"
;; ...direct namespace access.

View file

@ -103,6 +103,11 @@ Date/Publication: 2015-07-14 14:15:16
(set->list ((@ (guix import cran) extract-imports)
"this:is:not::a:procedure")))
(test-equal "extract-imports: matches things before a comma"
(list "MASS")
(set->list ((@ (guix import cran) extract-imports)
"check_installed(\"MASS\",")))
(test-equal "r-minimal is not a cran package"
#f
((@@ (guix import cran) cran-package?) r-minimal))