pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/pkgtools/lintpkgsrc/files/t



Module Name:    pkgsrc
Committed By:   rillig
Date:           Tue Aug  9 17:53:47 UTC 2022

Modified Files:
        pkgsrc/pkgtools/lintpkgsrc/files/t: glob.t

Log Message:
lintpkgsrc: add more tests for converting a glob into a regex


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.3 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.4
--- pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.3       Wed Aug  3 18:51:56 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t   Tue Aug  9 17:53:47 2022
@@ -1,4 +1,4 @@
-# $NetBSD: glob.t,v 1.3 2022/08/03 18:51:56 rillig Exp $
+# $NetBSD: glob.t,v 1.4 2022/08/09 17:53:47 rillig Exp $
 
 use strict;
 use warnings;
@@ -23,6 +23,16 @@ sub test_glob2regex() {
        # The '' means that the regular expression equals the glob.
        ok(glob2regex('[a-z0-9_]'), '');
 
+       # Outside of braces, the ',' is a regular character.
+       # The '' means that the regular expression equals the glob.
+       ok(glob2regex('a,b'), '');
+
+       # FIXME: Inside brackets, the '*' is a literal '*'.
+       ok(glob2regex('[*]'), '^[.*]$');
+
+       # FIXME: After a backslash, the '*' must be preserved.
+       ok(glob2regex('\*'), '^\.*$');
+
        ok(glob2regex('*.[ch]'), '^.*\.[ch]$');
 
        ok(glob2regex('{one,two}'), '^(one|two)$');
@@ -39,6 +49,11 @@ sub test_glob2regex() {
        # Escaping the backslash works nevertheless.
        ok(glob2regex('a\[b*'), '^a\[b.*$');
 
+       ok(glob2regex('a\+b'), '^a\.b$');
+
+       # FIXME: Must be '^a\?b$' instead.
+       ok(glob2regex('a\?b'), '^a\.b$');
+
        # XXX: Depending on the exact implementation, the '\n' may be
        # interpreted as a newline, a literal 'n' or a literal '\' 'n'.
        ok(glob2regex('a\n*'), '^a\n.*$');



Home | Main Index | Thread Index | Old Index