pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/lintpkgsrc
Module Name: pkgsrc
Committed By: rillig
Date: Sat Jul 30 16:20:18 UTC 2022
Modified Files:
pkgsrc/pkgtools/lintpkgsrc: Makefile
Added Files:
pkgsrc/pkgtools/lintpkgsrc/files/t: packages.t
Log Message:
lintpkgsrc: test code for storing package data
To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 pkgsrc/pkgtools/lintpkgsrc/Makefile
cvs rdiff -u -r0 -r1.1 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/Makefile
diff -u pkgsrc/pkgtools/lintpkgsrc/Makefile:1.42 pkgsrc/pkgtools/lintpkgsrc/Makefile:1.43
--- pkgsrc/pkgtools/lintpkgsrc/Makefile:1.42 Sat Jul 30 14:55:51 2022
+++ pkgsrc/pkgtools/lintpkgsrc/Makefile Sat Jul 30 16:20:18 2022
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2022/07/30 14:55:51 rillig Exp $
+# $NetBSD: Makefile,v 1.43 2022/07/30 16:20:18 rillig Exp $
PKGNAME= lintpkgsrc-4.99
CATEGORIES= pkgtools
@@ -8,6 +8,7 @@ HOMEPAGE= https://www.NetBSD.org/docs/pk
COMMENT= Sanity checks on the complete pkgsrc tree
DEPENDS+= digest>=20010101:../../pkgtools/digest
+TEST_DEPENDS+= p5-Capture-Tiny>=0:../../devel/p5-Capture-Tiny
CONFLICTS+= pkglint<4.82
USE_TOOLS+= perl:run
Added files:
Index: pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t
diff -u /dev/null pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t:1.1
--- /dev/null Sat Jul 30 16:20:18 2022
+++ pkgsrc/pkgtools/lintpkgsrc/files/t/packages.t Sat Jul 30 16:20:18 2022
@@ -0,0 +1,44 @@
+# $NetBSD: packages.t,v 1.1 2022/07/30 16:20:18 rillig Exp $
+
+use strict;
+use warnings;
+use Capture::Tiny 'capture';
+use Test;
+
+BEGIN { plan tests => 1; }
+
+$ENV{'TESTING_LINTPKGSRC'} = 'yes';
+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);
+}
+
+# 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