pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc/files/t lintpkgsrc: add more tests...
details: https://anonhg.NetBSD.org/pkgsrc/rev/e06e9c4436ea
branches: trunk
changeset: 382951:e06e9c4436ea
user: rillig <rillig%pkgsrc.org@localhost>
date: Tue Aug 09 17:53:47 2022 +0000
description:
lintpkgsrc: add more tests for converting a glob into a regex
diffstat:
pkgtools/lintpkgsrc/files/t/glob.t | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (38 lines):
diff -r 3920f61149bf -r e06e9c4436ea pkgtools/lintpkgsrc/files/t/glob.t
--- a/pkgtools/lintpkgsrc/files/t/glob.t Tue Aug 09 16:08:43 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/glob.t Tue Aug 09 17:53:47 2022 +0000
@@ -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 @@
# 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 @@
# 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