aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-glob)
  #:use-module (guix glob)
  #:use-module (srfi srfi-64))


(test-begin "glob")

(define-syntax test-string->sglob
  (syntax-rules (=>)
    ((_ pattern => result rest ...)
     (begin
       (test-equal (format #f "string->sglob, ~s" pattern)
         result
         (string->sglob pattern))
       (test-string->sglob rest ...)))
    ((_)
     #t)))

(define-syntax test-glob-match
  (syntax-rules (matches and not)
    ((_ (pattern-string matches strings ... (and not others ...)) rest ...)
     (begin
       (test-assert (format #f "glob-match? ~s" pattern-string)
         (let ((pattern (string->compiled-sglob pattern-string)))
           (and (glob-match? pattern strings) ...
                (not (glob-match? pattern others)) ...)))
       (test-glob-match rest ...)))
    ((_)
     #t)))

(test-string->sglob
 "foo" => "foo"
 "?foo*" => '(? "foo" *)
 "foo[1-5]" => '("foo" (range #\1 #\5))
 "foo[abc]bar" => '("foo" (set #\a #\b #\c) "bar")
 "foo[a[b]c]bar" => '("foo" (set #\a #\[ #\b #\] #\c) "bar")
 "[123]x" => '((set #\1 #\2 #\3) "x")
 "[a-z]" => '((range #\a #\z))
 "**/*.scm" => '(**/ * ".scm"))

(test-glob-match
 ("foo" matches "foo" (and not "foobar" "barfoo"))
 ("foo*" matches "foo" "foobar" (and not "xfoo"))
 ("foo??bar" matches "fooxxbar" "fooZZbar"
  (and not "foobar" "fooxxxbar" "fooxxbarzz"))
 ("foo?" matches "foox" (and not "fooxx"))
 ("ab[0-9]c" matches "ab0c" "ab7c" "ab9c"
  (and not "ab-c" "ab00c" "ab3"))
 ("ab[cdefg]" matches "abc" "abd" "abg"
  (and not "abh" "abcd" "ab["))
 ("foo/**/*.scm" matches "foo/bar/baz.scm" "foo/bar.scm" "foo/bar/baz/zab.scm"
  (and not "foo/bar/baz.java" "foo/bar.smc")))

(test-end "glob")
span>gnu: unbound: Update to 1.10.0....* gnu/packages/dns.scm (unbound): Update to 1.10.0. Signed-off-by: Jakub Kądziołka <kuba@kadziolka.net> Vincent Legoll 2020-03-07gnu: knot: Update to 2.9.3....* gnu/packages/dns.scm (knot): Update to 2.9.3. Tobias Geerinckx-Rice 2020-03-03gnu: yadifa: Use HTTPS home page....* gnu/packages/dns.scm (yadifa)[home-page]: Use HTTPS. Tobias Geerinckx-Rice 2020-02-22gnu: bind: Update to 9.16.0....* gnu/packages/dns.scm (isc-bind): Update to 9.16.0. [inputs]: Add libuv. [native-inputs]: Add pkg-config. Remove net-tools. [arguments]: Remove obsolete --with-openssl= from #:configure-flags. Tobias Geerinckx-Rice 2020-02-16gnu: libasr: Update to 1.0.4....* gnu/packages/dns.scm (libasr): Update to 1.0.4. [arguments]: Remove obsolete ‘bootstrap’ phase replacement. Tobias Geerinckx-Rice 2020-02-16gnu: ddclient: Update home page....* gnu/packages/dns.scm (ddclient)[home-page]: Update. Tobias Geerinckx-Rice 2020-02-16gnu: ddclient: Update to 3.9.1....* gnu/packages/dns.scm (ddclient): Update to 3.9.1. [source]: Use GIT-FETCH and add a FILE-NAME. [native-inputs]: Remove gzip and tar. [arguments]: Adapt to git checkout source. Tobias Geerinckx-Rice 2020-02-15gnu: unbound: Update to 1.9.6 [security improvements]....* gnu/packages/dns.scm (unbound): Update to 1.9.6. Tobias Geerinckx-Rice 2020-02-10gnu: unbound: Remove redundant input....* gnu/packages/dns.scm (unbound)[inputs]: Remove PYTHON-3. Marius Bakke 2020-01-23gnu: bind: Update to 9.14.10....* gnu/packages/dns.scm (bind): Update to 9.14.10. Tobias Geerinckx-Rice 2020-01-22gnu: knot-resolver: Install but disable the default managed root TA....* gnu/packages/dns.scm (knot-resolver)[arguments]: Enable 'managed_ta', so 'icann-ca.pem' get installed. Add 'disable-default-ta' phase. 宋文武 2020-01-15gnu: unbound: Update to 1.9.5 [fixes CVE-2019-18934]....The Guix unbound package is not vulnerable in its default configuration, because we do not build with ‘--enable-ipsecmod’. * gnu/packages/dns.scm (unbound): Update to 1.9.5. Tobias Geerinckx-Rice 2019-12-23gnu: nsd: Update to 4.2.4....* gnu/packages/dns.scm (nsd): Update to 4.2.4. Tobias Geerinckx-Rice 2019-12-23gnu: knot: Update to 2.9.2....* gnu/packages/dns.scm (knot): Update to 2.9.2. Tobias Geerinckx-Rice 2019-12-23gnu: knot-resolver: Update to 4.3.0 [fixes CVE-2019-19331]....* gnu/packages/dns.scm (knot-resolver): Update to 4.3.0. Tobias Geerinckx-Rice 2019-12-19gnu: bind: Update to 9.14.9....* gnu/packages/dns.scm (isc-bind): Update to 9.14.9. Tobias Geerinckx-Rice 2019-12-04gnu: knot: Update to 2.9.1 [fixes CVE-2019-19331]....* gnu/packages/dns.scm (knot): Update to 2.9.1. Leo Famulari 2019-12-03gnu: nsd: Update to 4.2.3....* gnu/packages/dns.scm (nsd): Update to 4.2.3. Tobias Geerinckx-Rice 2019-11-20gnu: bind: Update to 9.14.8 [fixes CVE-2019-6477]....* gnu/packages/dns.scm (isc-bind): Update to 9.14.8. Tobias Geerinckx-Rice 2019-11-11gnu: Add knot-resolver....* gnu/packages/dns.scm (knot-resolver): New package. 宋文武 2019-10-29gnu: libasr: Update to 1.0.3....* gnu/packages/dns.scm (libasr): Update to 1.0.3. [arguments]: Replace ‘bootstrap’ and add ‘install-documentation’ phase. [native-inputs]: Add libtool and remove groff. Tobias Geerinckx-Rice 2019-10-27gnu: unbound: Update to 1.9.4....* gnu/packages/dns.scm (unbound): Update to 1.9.4. Tobias Geerinckx-Rice 2019-10-27gnu: libasr: Don't use NAME in source URI....* gnu/packages/dns.scm (libasr)[source]: Hard-code NAME. Tobias Geerinckx-Rice 2019-10-16gnu: bind: Update to 9.14.7 [fixes CVE-2019-6475 & CVE-2019-6476]....* gnu/packages/dns.scm (isc-bind): Update to 9.14.7. Tobias Geerinckx-Rice 2019-10-11gnu: knot: Update to 2.9.0....* gnu/packages/dns.scm (knot): Update to 2.9.0. Tobias Geerinckx-Rice 2019-09-18gnu: bind: Update to 9.14.6 [fixes CVE-2019-6471]....* gnu/packages/dns.scm (isc-bind): Update to 9.14.6. Tobias Geerinckx-Rice 2019-09-17gnu: unbound: Update to 1.9.3....* gnu/packages/dns.scm (unbound): Update to 1.9.3. Tobias Geerinckx-Rice 2019-08-22gnu: nsd: Update to 4.2.2....* gnu/packages/dns.scm (nsd): Update to 4.2.2. Tobias Geerinckx-Rice 2019-08-22gnu: bind: Update to 9.14.5....* gnu/packages/dns.scm (isc-bind): Update to 9.14.5. Tobias Geerinckx-Rice 2019-07-28gnu: unbound: Update to 1.9.2....* gnu/packages/dns.scm (unbound): Update to 1.9.2. Rutger Helling 2019-07-18gnu: bind: Update to 9.14.4....* gnu/packages/dns.scm (bind): Update to 9.14.4. Tobias Geerinckx-Rice 2019-06-20gnu: bind: Update to 9.14.3 [fixes CVE-2019-6471]....* gnu/packages/dns.scm (isc-bind): Update to 9.14.3. Tobias Geerinckx-Rice 2019-06-17gnu: nsd: Update to 4.2.0....* gnu/packages/dns.scm (nsd): Update to 4.2.0. Tobias Geerinckx-Rice 2019-06-17gnu: knot: Update to 2.8.2....* gnu/packages/dns.scm (knot): Update to 2.8.2. Tobias Geerinckx-Rice 2019-05-16gnu: bind: Update to 9.14.2....* gnu/packages/dns.scm (isc-bind): Update to 9.14.2. [source]: Remove patch. [arguments]: Run only fuzz tests. * gnu/packages/patches/bind-fix-unused-pk11-ecc-constants.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. Tobias Geerinckx-Rice 2019-04-24gnu: Add public-suffix-list....* gnu/packages/dns.scm (public-suffix-list): New variable. Chris Marusich 2019-04-25gnu: bind: Update to 9.12.4-P1 [fixes CVE-2018-5743, CVE-2019-6467]....* gnu/packages/dns.scm (isc-bind): Update to 9.12.4-P1. [source]: Add patch. [inputs]: Add python and python-ply. * packages/patches/bind-fix-unused-pk11-ecc-constants.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. Tobias Geerinckx-Rice 2019-04-22gnu: nsd: Update to 4.1.27....* gnu/packages/dns.scm (nsd): Update to 4.1.27. Tobias Geerinckx-Rice 2019-04-15gnu: knot: Update to 2.8.1....* gnu/packages/dns.scm (knot): Update to 2.8.1. [source]: Remove patch. * gnu/packages/patches/knot-include-system-lmdb-header.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. Tobias Geerinckx-Rice