diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2018-03-18 22:54:34 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2018-03-18 22:57:17 +0100 |
| commit | 71e08fde28fa335bdba2ec2150fd6663390bba5a (patch) | |
| tree | 71d35060faa1f92b6e15236098a58c4da6e8d84f /tests/glob.scm | |
| parent | e914b398af11f909e88a8bc85eeebb0768aacd54 (diff) | |
glob: Add an extra glob pattern compilation stage.
* guix/glob.scm (compile-glob-pattern): Rename to...
(string->sglob): ... this.
(compile-sglob, string->compiled-sglob): New procedures.
(glob-match?): Replace '?, 'range, and 'set with a single clause.
* tests/glob.scm (test-compile-glob-pattern): Rename to...
(test-string->sglob): ... this. Adjust accordingly.
(test-glob-match): Use 'string->compiled-sglob' instead of
'compile-glob-pattern'.
* gnu/build/linux-modules.scm (read-module-aliases): Use
'string->compiled-sglob' instead of 'compile-glob-pattern'.
Diffstat (limited to 'tests/glob.scm')
| -rw-r--r-- | tests/glob.scm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/glob.scm b/tests/glob.scm index 71e2d3fce07..31340697899 100644 --- a/tests/glob.scm +++ b/tests/glob.scm | |||
| @@ -23,14 +23,14 @@ | |||
| 23 | 23 | ||
| 24 | (test-begin "glob") | 24 | (test-begin "glob") |
| 25 | 25 | ||
| 26 | (define-syntax test-compile-glob-pattern | 26 | (define-syntax test-string->sglob |
| 27 | (syntax-rules (=>) | 27 | (syntax-rules (=>) |
| 28 | ((_ pattern => result rest ...) | 28 | ((_ pattern => result rest ...) |
| 29 | (begin | 29 | (begin |
| 30 | (test-equal (format #f "compile-glob-pattern, ~s" pattern) | 30 | (test-equal (format #f "string->sglob, ~s" pattern) |
| 31 | result | 31 | result |
| 32 | (compile-glob-pattern pattern)) | 32 | (string->sglob pattern)) |
| 33 | (test-compile-glob-pattern rest ...))) | 33 | (test-string->sglob rest ...))) |
| 34 | ((_) | 34 | ((_) |
| 35 | #t))) | 35 | #t))) |
| 36 | 36 | ||
| @@ -39,14 +39,14 @@ | |||
| 39 | ((_ (pattern-string matches strings ... (and not others ...)) rest ...) | 39 | ((_ (pattern-string matches strings ... (and not others ...)) rest ...) |
| 40 | (begin | 40 | (begin |
| 41 | (test-assert (format #f "glob-match? ~s" pattern-string) | 41 | (test-assert (format #f "glob-match? ~s" pattern-string) |
| 42 | (let ((pattern (compile-glob-pattern pattern-string))) | 42 | (let ((pattern (string->compiled-sglob pattern-string))) |
| 43 | (and (glob-match? pattern strings) ... | 43 | (and (glob-match? pattern strings) ... |
| 44 | (not (glob-match? pattern others)) ...))) | 44 | (not (glob-match? pattern others)) ...))) |
| 45 | (test-glob-match rest ...))) | 45 | (test-glob-match rest ...))) |
| 46 | ((_) | 46 | ((_) |
| 47 | #t))) | 47 | #t))) |
| 48 | 48 | ||
| 49 | (test-compile-glob-pattern | 49 | (test-string->sglob |
| 50 | "foo" => "foo" | 50 | "foo" => "foo" |
| 51 | "?foo*" => '(? "foo" *) | 51 | "?foo*" => '(? "foo" *) |
| 52 | "foo[1-5]" => '("foo" (range #\1 #\5)) | 52 | "foo[1-5]" => '("foo" (range #\1 #\5)) |
