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: Wed Aug 3 18:24:59 UTC 2022
Modified Files:
pkgsrc/pkgtools/lintpkgsrc/files/t: glob.t packages.t parse_makefile.t
Log Message:
lintpkgsrc: use LF line endings in tests
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t \
pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t
cvs rdiff -u -r1.2 -r1.3 pkgsrc/pkgtools/lintpkgsrc/files/t/packages.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.1 pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.2
--- pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t:1.1 Wed Aug 3 16:15:49 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/glob.t Wed Aug 3 18:24:59 2022
@@ -1,47 +1,47 @@
-# $NetBSD: glob.t,v 1.1 2022/08/03 16:15:49 rillig Exp $
-
-use strict;
-use warnings;
-use Test;
-
-BEGIN { plan tests => 12; }
-
-require('../lintpkgsrc.pl');
-
-sub test_glob2regex() {
-
- ok(glob2regex('*'), '^.*$');
-
- ok(glob2regex('?'), '^.$');
-
- # The '' means that the regular expression equals the glob.
- ok(glob2regex('[a-z]'), '');
-
- # The '' means that the regular expression equals the glob.
- ok(glob2regex('[a-z0-9]'), '');
-
- # The '' means that the regular expression equals the glob.
- ok(glob2regex('[a-z0-9_]'), '');
-
- ok(glob2regex('*.[ch]'), '^.*\.[ch]$');
-
- ok(glob2regex('{one,two}'), '^(one|two)$');
-
- ok(glob2regex('{{thi,fou}r,fif}teen'), '^((thi|fou)r|fif)teen$');
-
- # There is an unbalanced '}' at the very end.
- ok(glob2regex('{{thi,fou}r,fif}teen}'), undef);
-
- # XXX: Why is '+' turned into '.'?
- ok(glob2regex('a+b|c'), '^a.b\|c$');
-
- # XXX: Typo in the code, the case '\\+' is unreachable.
- # Escaping the backslash works nevertheless.
- 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.*$');
-}
-
-test_glob2regex();
+# $NetBSD: glob.t,v 1.2 2022/08/03 18:24:59 rillig Exp $
+
+use strict;
+use warnings;
+use Test;
+
+BEGIN { plan tests => 12; }
+
+require('../lintpkgsrc.pl');
+
+sub test_glob2regex() {
+
+ ok(glob2regex('*'), '^.*$');
+
+ ok(glob2regex('?'), '^.$');
+
+ # The '' means that the regular expression equals the glob.
+ ok(glob2regex('[a-z]'), '');
+
+ # The '' means that the regular expression equals the glob.
+ ok(glob2regex('[a-z0-9]'), '');
+
+ # The '' means that the regular expression equals the glob.
+ ok(glob2regex('[a-z0-9_]'), '');
+
+ ok(glob2regex('*.[ch]'), '^.*\.[ch]$');
+
+ ok(glob2regex('{one,two}'), '^(one|two)$');
+
+ ok(glob2regex('{{thi,fou}r,fif}teen'), '^((thi|fou)r|fif)teen$');
+
+ # There is an unbalanced '}' at the very end.
+ ok(glob2regex('{{thi,fou}r,fif}teen}'), undef);
+
+ # XXX: Why is '+' turned into '.'?
+ ok(glob2regex('a+b|c'), '^a.b\|c$');
+
+ # XXX: Typo in the code, the case '\\+' is unreachable.
+ # Escaping the backslash works nevertheless.
+ 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.*$');
+}
+
+test_glob2regex();
Index: pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.1 pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.2
--- pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t:1.1 Wed Aug 3 16:15:49 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/parse_makefile.t Wed Aug 3 18:24:59 2022
@@ -1,56 +1,56 @@
-# $NetBSD: parse_makefile.t,v 1.1 2022/08/03 16:15:49 rillig Exp $
-
-use strict;
-use warnings;
-use File::Slurp;
-use File::Temp;
-use Test;
-
-BEGIN { plan tests => 6; }
-
-require('../lintpkgsrc.pl');
-
-sub test_parse_expand_vars() {
- my %vars = (
- CFLAGS => '${CFLAGS_OPT} ${CFLAGS_WARN} ${CFLAGS_ERR}',
- CFLAGS_WARN => '${CFLAGS_WARN_ALL}',
- CFLAGS_OPT => '-Os',
- CFLAGS_ERR => '${CFLAGS_WARN_ALL:M*error=*}',
- );
-
- my $cflags = parse_expand_vars('<${CFLAGS}>', \%vars);
-
- ok($cflags, '<-Os M_a_G_i_C_uNdEfInEd ${CFLAGS_WARN_ALL:M*error=*}>')
-}
-
-sub test_parse_makefile_vars() {
- my $dir = File::Temp->newdir();
- my $file = "$dir/filename.mk";
-
- write_file($file,
- "# comment\n",
- "VAR=\tvalue\n",
- "COMMENT=\tvalue#comment\n",
- "MULTI=\tone\\\n",
- "\ttwo\\\n",
- "three#comment\n"
- );
-
- my $vars = parse_makefile_vars($file, undef);
-
- ok(
- join(', ', sort keys %$vars),
- '.CURDIR, BSD_PKG_MK, COMMENT, MULTI, VAR');
- ok($vars->{BSD_PKG_MK}, 'YES');
-
- # FIXME: must be 'value'
- ok($vars->{COMMENT}, 'valu');
-
- # FIXME: must be 'one two three'
- ok($vars->{MULTI}, "on\ttwthree#comment");
-
- ok($vars->{VAR}, 'value');
-}
-
-test_parse_expand_vars();
-test_parse_makefile_vars();
+# $NetBSD: parse_makefile.t,v 1.2 2022/08/03 18:24:59 rillig Exp $
+
+use strict;
+use warnings;
+use File::Slurp;
+use File::Temp;
+use Test;
+
+BEGIN { plan tests => 6; }
+
+require('../lintpkgsrc.pl');
+
+sub test_parse_expand_vars() {
+ my %vars = (
+ CFLAGS => '${CFLAGS_OPT} ${CFLAGS_WARN} ${CFLAGS_ERR}',
+ CFLAGS_WARN => '${CFLAGS_WARN_ALL}',
+ CFLAGS_OPT => '-Os',
+ CFLAGS_ERR => '${CFLAGS_WARN_ALL:M*error=*}',
+ );
+
+ my $cflags = parse_expand_vars('<${CFLAGS}>', \%vars);
+
+ ok($cflags, '<-Os M_a_G_i_C_uNdEfInEd ${CFLAGS_WARN_ALL:M*error=*}>')
+}
+
+sub test_parse_makefile_vars() {
+ my $dir = File::Temp->newdir();
+ my $file = "$dir/filename.mk";
+
+ write_file($file,
+ "# comment\n",
+ "VAR=\tvalue\n",
+ "COMMENT=\tvalue#comment\n",
+ "MULTI=\tone\\\n",
+ "\ttwo\\\n",
+ "three#comment\n"
+ );
+
+ my $vars = parse_makefile_vars($file, undef);
+
+ ok(
+ join(', ', sort keys %$vars),
+ '.CURDIR, BSD_PKG_MK, COMMENT, MULTI, VAR');
+ ok($vars->{BSD_PKG_MK}, 'YES');
+
+ # FIXME: must be 'value'
+ ok($vars->{COMMENT}, 'valu');
+
+ # FIXME: must be 'one two three'
+ ok($vars->{MULTI}, "on\ttwthree#comment");
+
+ ok($vars->{VAR}, 'value');
+}
+
+test_parse_expand_vars();
+test_parse_makefile_vars();
Index: pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t
diff -u pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.2 pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.3
--- pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.2 Sat Jul 30 17:06:29 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t Wed Aug 3 18:24:59 2022
@@ -1,61 +1,61 @@
-# $NetBSD: packages.t,v 1.2 2022/07/30 17:06:29 rillig Exp $
-
-use strict;
-use warnings;
-use Capture::Tiny 'capture';
-use Test;
-
-BEGIN { plan tests => 8; }
-
-require('../lintpkgsrc.pl');
-
-sub test_package_variables() {
- my $pkglist = PkgList->new();
- my $pkgbase_1_0 = $pkglist->add('pkgbase', '1.0');
-
- $pkgbase_1_0->var('NAME', 'value');
-
- ok($pkgbase_1_0->var('NAME'), 'value');
- ok($pkgbase_1_0->var('undefined'), undef);
-
- my $pkgbase_2_0 = $pkglist->add('pkgbase', '2.0');
- my $pkgbase_1_5 = $pkglist->add('pkgbase', '1.5');
- my $pkgbase_1_10 = $pkglist->add('pkgbase', '1.10');
-
- $pkgbase_2_0->var('COMMENT', 'Version 2 of the package');
-
- ok($pkglist->pkgs('unknown-pkgbase'), undef);
-
- # The versions are sorted in decreasing alphabetical order.
- my $versions = join(', ', $pkglist->pkgs('pkgbase')->versions());
- ok($versions, '2.0, 1.5, 1.10, 1.0');
-
- # The versioned packages are sorted in decreasing alphabetical order.
- my @pkgvers = $pkglist->pkgver('pkgbase');
- ok(join(', ', map { $_->ver } @pkgvers), '2.0, 1.5, 1.10, 1.0');
- ok($pkgvers[0], $pkgbase_2_0);
- ok($pkgvers[3], $pkgbase_1_0);
-}
-
-# Demonstrate how the package data is stored in the cache file.
-sub test_store_order() {
- my $pkglist = PkgList->new();
-
- my $pkgbase_1_0 = $pkglist->add('pkgbase', '1.0');
- my $pkgbase_1_3nb4 = $pkglist->add('pkgbase', '1.3nb4');
- my $pkgbase_1_15 = $pkglist->add('pkgbase', '1.15');
-
- my $stdout = capture {
- $pkglist->store();
- };
-
- # XXX: 1.3nb4 should be sorted before 1.15.
- # On the other hand, this is just an internal cache file format.
- ok($stdout, ''
- . "package\tpkgbase\t1.0\n"
- . "package\tpkgbase\t1.15\n"
- . "package\tpkgbase\t1.3nb4\n");
-}
-
-test_package_variables();
-test_store_order();
+# $NetBSD: packages.t,v 1.3 2022/08/03 18:24:59 rillig Exp $
+
+use strict;
+use warnings;
+use Capture::Tiny 'capture';
+use Test;
+
+BEGIN { plan tests => 8; }
+
+require('../lintpkgsrc.pl');
+
+sub test_package_variables() {
+ my $pkglist = PkgList->new();
+ my $pkgbase_1_0 = $pkglist->add('pkgbase', '1.0');
+
+ $pkgbase_1_0->var('NAME', 'value');
+
+ ok($pkgbase_1_0->var('NAME'), 'value');
+ ok($pkgbase_1_0->var('undefined'), undef);
+
+ my $pkgbase_2_0 = $pkglist->add('pkgbase', '2.0');
+ my $pkgbase_1_5 = $pkglist->add('pkgbase', '1.5');
+ my $pkgbase_1_10 = $pkglist->add('pkgbase', '1.10');
+
+ $pkgbase_2_0->var('COMMENT', 'Version 2 of the package');
+
+ ok($pkglist->pkgs('unknown-pkgbase'), undef);
+
+ # The versions are sorted in decreasing alphabetical order.
+ my $versions = join(', ', $pkglist->pkgs('pkgbase')->versions());
+ ok($versions, '2.0, 1.5, 1.10, 1.0');
+
+ # The versioned packages are sorted in decreasing alphabetical order.
+ my @pkgvers = $pkglist->pkgver('pkgbase');
+ ok(join(', ', map { $_->ver } @pkgvers), '2.0, 1.5, 1.10, 1.0');
+ ok($pkgvers[0], $pkgbase_2_0);
+ ok($pkgvers[3], $pkgbase_1_0);
+}
+
+# Demonstrate how the package data is stored in the cache file.
+sub test_store_order() {
+ my $pkglist = PkgList->new();
+
+ my $pkgbase_1_0 = $pkglist->add('pkgbase', '1.0');
+ my $pkgbase_1_3nb4 = $pkglist->add('pkgbase', '1.3nb4');
+ my $pkgbase_1_15 = $pkglist->add('pkgbase', '1.15');
+
+ my $stdout = capture {
+ $pkglist->store();
+ };
+
+ # XXX: 1.3nb4 should be sorted before 1.15.
+ # On the other hand, this is just an internal cache file format.
+ ok($stdout, ''
+ . "package\tpkgbase\t1.0\n"
+ . "package\tpkgbase\t1.15\n"
+ . "package\tpkgbase\t1.3nb4\n");
+}
+
+test_package_variables();
+test_store_order();
Home |
Main Index |
Thread Index |
Old Index