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: use LF line en...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/61f927c60107
branches:  trunk
changeset: 382717:61f927c60107
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Aug 03 18:24:59 2022 +0000

description:
lintpkgsrc: use LF line endings in tests

diffstat:

 pkgtools/lintpkgsrc/files/t/glob.t           |   94 ++++++++++----------
 pkgtools/lintpkgsrc/files/t/packages.t       |  122 +++++++++++++-------------
 pkgtools/lintpkgsrc/files/t/parse_makefile.t |  112 ++++++++++++------------
 3 files changed, 164 insertions(+), 164 deletions(-)

diffs (truncated from 340 to 300 lines):

diff -r d221d8757c88 -r 61f927c60107 pkgtools/lintpkgsrc/files/t/glob.t
--- a/pkgtools/lintpkgsrc/files/t/glob.t        Wed Aug 03 17:14:53 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/glob.t        Wed Aug 03 18:24:59 2022 +0000
@@ -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();
diff -r d221d8757c88 -r 61f927c60107 pkgtools/lintpkgsrc/files/t/packages.t
--- a/pkgtools/lintpkgsrc/files/t/packages.t    Wed Aug 03 17:14:53 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/packages.t    Wed Aug 03 18:24:59 2022 +0000
@@ -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();
diff -r d221d8757c88 -r 61f927c60107 pkgtools/lintpkgsrc/files/t/parse_makefile.t
--- a/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Wed Aug 03 17:14:53 2022 +0000
+++ b/pkgtools/lintpkgsrc/files/t/parse_makefile.t      Wed Aug 03 18:24:59 2022 +0000
@@ -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}',



Home | Main Index | Thread Index | Old Index