3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
19 use Test::More tests => 5;
20 use Test::Dpkg qw(:paths);
23 use_ok('Dpkg::Control::Tests');
26 my $datadir = test_get_data_path('t/Dpkg_Control_Tests');
31 my $tests = Dpkg::Control::Tests->new();
42 $tests = parse_tests("$datadir/tests-missing-fields");
43 is($tests, undef, 'autopkgtest missing required fields');
45 $tests = parse_tests("$datadir/tests-plain-text");
46 is($tests, undef, 'autopkgtest is not in deb822 format');
48 my $expected = <<'TESTS';
51 Tests: danger, warning
52 Restrictions: rw-build-tree, needs-root, breaks-testbed
55 Depends: @, @builddeps@, extra-package
65 Test-Command: command arg1 arg2
69 $tests = parse_tests("$datadir/tests-valid");
70 ok(defined $tests, 'Valid autopkgtest control file');
71 is($tests->output(), $expected, 'autopkgtest control file dumped');