summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2013-03-26 15:10:31 +0000
committerschmonz <schmonz@pkgsrc.org>2013-03-26 15:10:31 +0000
commit092887ea839dbc7e209bd269d420beda89f9e4ff (patch)
treeaf48d742b2baabd47b005965bc9d5b5f34ed4ac5 /pkgtools
parent603da18917d873c78644b2aea193cb371c979974 (diff)
downloadpkgsrc-092887ea839dbc7e209bd269d420beda89f9e4ff.tar.gz
Bag-compare all vartypes_basictypes, not just two.
pkglint greps itself (really) to generate this list of types. Test exhaustively for all types in the list today, so that the tested code can become more civilized tomorrow. Adds a test-time dependency on Test::Deep for cmp_bag().
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkglint/Makefile3
-rw-r--r--pkgtools/pkglint/files/pkglint.t37
2 files changed, 34 insertions, 6 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile
index 49fe4d3ca17..1587a09a72f 100644
--- a/pkgtools/pkglint/Makefile
+++ b/pkgtools/pkglint/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.426 2013/03/26 15:09:35 schmonz Exp $
+# $NetBSD: Makefile,v 1.427 2013/03/26 15:10:31 schmonz Exp $
# Note: if you update the version number, please have a look at the
# changes between the CVS tag "pkglint_current" and HEAD.
@@ -16,6 +16,7 @@ DEPENDS+= p5-Digest-SHA1-[0-9]*:../../security/p5-Digest-SHA1
DEPENDS+= p5-enum>=1.016:../../devel/p5-enum
DEPENDS+= p5-pkgsrc-Dewey>=1.0:../../pkgtools/p5-pkgsrc-Dewey
+BUILD_DEPENDS+= p5-Test-Deep-[0-9]*:../../devel/p5-Test-Deep
BUILD_DEPENDS+= p5-Test-Trap-[0-9]*:../../devel/p5-Test-Trap
PKG_INSTALLATION_TYPES= overwrite pkgviews
diff --git a/pkgtools/pkglint/files/pkglint.t b/pkgtools/pkglint/files/pkglint.t
index 52e0b139ba8..a32c98af84f 100644
--- a/pkgtools/pkglint/files/pkglint.t
+++ b/pkgtools/pkglint/files/pkglint.t
@@ -1,11 +1,12 @@
#! @PERL@
-# $NetBSD: pkglint.t,v 1.6 2013/03/26 15:10:03 schmonz Exp $
+# $NetBSD: pkglint.t,v 1.7 2013/03/26 15:10:32 schmonz Exp $
#
require 'pkglint.pl'; # so we can test its internals
$pkglint::program = 'pkglint.pl'; # because it self-greps for vartypes
-use Test::More tests => 37;
+use Test::More tests => 36;
+use Test::Deep;
use Test::Trap;
use Config;
@@ -31,7 +32,7 @@ sub test_unit {
}
like($trap->stdout, qr/$stdout_re/sm, qq{stdout matches $stdout_re});
like($trap->stderr, qr/$stderr_re/sm, qq{stderr matches $stderr_re});
-
+
return @results;
}
@@ -68,8 +69,34 @@ sub test_get_vartypes_basictypes {
my @results = test_unit($unit);
my %types = %{$results[0]};
- is($types{BuildlinkDepmethod}, 1, q{a couple expected types are here});
- is($types{YesNo_Indirectly}, 1, q{a couple expected types are here});
+
+ my @all_vartypes_basictypes = qw(
+ ARRAY AwkCommand BrokenIn
+ BuildlinkDepmethod BuildlinkDepth BuildlinkPackages
+ CFlag Category Comment
+ Dependency DependencyWithPath
+ DistSuffix EmulPlatform
+ FileMode Filemask Filename
+ Identifier Integer LdFlag License Mail_Address Message Option
+ Pathlist Pathmask Pathname
+ Perl5Packlist
+ PkgName PkgOptionsVar PkgPath PkgRevision
+ PlatformTriple PrefixPathname
+ RelativePkgDir RelativePkgPath
+ Restricted SVR4PkgName
+ SedCommand SedCommands
+ ShellCommand ShellWord
+ Stage String Tool URL Unchecked UserGroupName Varname Version
+ WrapperReorder WrapperTransform
+ WrkdirSubdirectory WrksrcSubdirectory
+ Yes YesNo YesNo_Indirectly
+ );
+
+ cmp_bag(
+ [ keys %types ],
+ \@all_vartypes_basictypes,
+ q{types contains all expected and no unexpected types},
+ );
}
sub test_get_vartypes_map {