diff options
author | schmonz <schmonz> | 2013-03-26 15:04:30 +0000 |
---|---|---|
committer | schmonz <schmonz> | 2013-03-26 15:04:30 +0000 |
commit | c0678d53ca427cf5896b5e797ca2bf4005931c5e (patch) | |
tree | 5b01c7c8e11196a2c5e305ed706c747db168d272 /pkgtools | |
parent | 764a327a38cf64e332b1b06d40d96fc74d487629 (diff) | |
download | pkgsrc-c0678d53ca427cf5896b5e797ca2bf4005931c5e.tar.gz |
Give test_unit() better defaults for easier calling.
This is the first commit in a set developed for my "Rehabilitating
pkglint" talk at pkgsrcCon 2013.
Reviewed-at-pkgsrcCon-and-approved-during-the-freeze-by: wiz
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.t | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pkgtools/pkglint/files/pkglint.t b/pkgtools/pkglint/files/pkglint.t index d34e24a6964..a6c8b1e0073 100644 --- a/pkgtools/pkglint/files/pkglint.t +++ b/pkgtools/pkglint/files/pkglint.t @@ -1,5 +1,5 @@ #! @PERL@ -# $NetBSD: pkglint.t,v 1.3 2013/01/20 03:50:05 schmonz Exp $ +# $NetBSD: pkglint.t,v 1.4 2013/03/26 15:04:30 schmonz Exp $ # require 'pkglint.pl'; # so we can test its internals @@ -15,6 +15,8 @@ use strict; sub test_unit { my ($unit, $params, $exitcode, $stdout_re, $stderr_re) = @_; + $stdout_re ||= '^$'; + $stderr_re ||= '^$'; my @results = trap { $unit->(@{$params}) }; @@ -32,7 +34,7 @@ sub test_unit { sub test_get_vartypes_basictypes { my $unit = \&main::get_vartypes_basictypes; - my @results = test_unit($unit, undef, undef, '^$', '^$'); + 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}); @@ -41,7 +43,7 @@ sub test_get_vartypes_basictypes { sub test_get_vartypes_map { my $unit = \&main::get_vartypes_map; - my @results = test_unit($unit, undef, undef, '^$', '^$'); + my @results = test_unit($unit); my %map = %{$results[0]}; is($map{'BSD_MAKE_ENV'}->basic_type(), 'ShellWord', q{a couple expected vars are typed right}); |