diff options
author | schmonz <schmonz@pkgsrc.org> | 2013-03-26 15:04:30 +0000 |
---|---|---|
committer | schmonz <schmonz@pkgsrc.org> | 2013-03-26 15:04:30 +0000 |
commit | f1d80d959250df5f0c57e9cefac809504576debe (patch) | |
tree | 5b01c7c8e11196a2c5e305ed706c747db168d272 | |
parent | 62884f3c86f605972677b0e918fe165584d4184e (diff) | |
download | pkgsrc-f1d80d959250df5f0c57e9cefac809504576debe.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
-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}); |