pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/lintpkgsrc lintpkgsrc: test code for storing ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/2dc7fe545ae4
branches: trunk
changeset: 382535:2dc7fe545ae4
user: rillig <rillig%pkgsrc.org@localhost>
date: Sat Jul 30 16:20:18 2022 +0000
description:
lintpkgsrc: test code for storing package data
diffstat:
pkgtools/lintpkgsrc/Makefile | 3 +-
pkgtools/lintpkgsrc/files/t/packages.t | 44 ++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletions(-)
diffs (65 lines):
diff -r d2de9029d5f5 -r 2dc7fe545ae4 pkgtools/lintpkgsrc/Makefile
--- a/pkgtools/lintpkgsrc/Makefile Sat Jul 30 16:14:29 2022 +0000
+++ b/pkgtools/lintpkgsrc/Makefile Sat Jul 30 16:20:18 2022 +0000
@@ -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 @@
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
diff -r d2de9029d5f5 -r 2dc7fe545ae4 pkgtools/lintpkgsrc/files/t/packages.t
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/lintpkgsrc/files/t/packages.t Sat Jul 30 16:20:18 2022 +0000
@@ -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