aboutsummaryrefslogtreecommitdiff
path: root/tests/glob.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-03-18 22:54:34 +0100
committerLudovic Courtès <ludo@gnu.org>2018-03-18 22:57:17 +0100
commit71e08fde28fa335bdba2ec2150fd6663390bba5a (patch)
tree71d35060faa1f92b6e15236098a58c4da6e8d84f /tests/glob.scm
parente914b398af11f909e88a8bc85eeebb0768aacd54 (diff)
downloadguix-71e08fde28fa335bdba2ec2150fd6663390bba5a.tar
guix-71e08fde28fa335bdba2ec2150fd6663390bba5a.tar.gz
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.scm12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/glob.scm b/tests/glob.scm
index 71e2d3fce0..3134069789 100644
--- a/tests/glob.scm
+++ b/tests/glob.scm
@@ -23,14 +23,14 @@
(test-begin "glob")
-(define-syntax test-compile-glob-pattern
+(define-syntax test-string->sglob
(syntax-rules (=>)
((_ pattern => result rest ...)
(begin
- (test-equal (format #f "compile-glob-pattern, ~s" pattern)
+ (test-equal (format #f "string->sglob, ~s" pattern)
result
- (compile-glob-pattern pattern))
- (test-compile-glob-pattern rest ...)))
+ (string->sglob pattern))
+ (test-string->sglob rest ...)))
((_)
#t)))
@@ -39,14 +39,14 @@
((_ (pattern-string matches strings ... (and not others ...)) rest ...)
(begin
(test-assert (format #f "glob-match? ~s" pattern-string)
- (let ((pattern (compile-glob-pattern 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-compile-glob-pattern
+(test-string->sglob
"foo" => "foo"
"?foo*" => '(? "foo" *)
"foo[1-5]" => '("foo" (range #\1 #\5))