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
=> 21;
22 use_ok
('Dpkg::OpenPGP::KeyHandle');
28 handle
=> '0x12345678',
30 exp_handle
=> '12345678',
33 handle
=> '0x1234567890abcdef',
35 exp_handle
=> '1234567890abcdef',
38 handle
=> '0x1234567890abcdef1234567890abcdef',
40 exp_handle
=> '1234567890abcdef1234567890abcdef',
43 handle
=> 'Alice Auster',
45 exp_handle
=> 'Alice Auster',
48 handle
=> 'Alice Auster <alice@example.org>',
50 exp_handle
=> 'Alice Auster <alice@example.org>',
53 handle
=> '0x12345678',
55 exp_handle
=> '12345678',
58 handle
=> '0x1234567890abcdef',
60 exp_handle
=> '1234567890abcdef',
63 handle
=> '0x1234567890abcdef1234567890abcdef',
65 exp_handle
=> '1234567890abcdef1234567890abcdef',
68 handle
=> 'Alice Auster',
70 exp_handle
=> 'Alice Auster',
73 handle
=> 'Alice Auster <alice@example.org>',
75 exp_handle
=> 'Alice Auster <alice@example.org>',
79 foreach my $ref_key (@ref_keys) {
80 my $key = Dpkg
::OpenPGP
::KeyHandle
->new(
81 type
=> $ref_key->{type
},
82 handle
=> $ref_key->{handle
},
84 is
($key->type, $ref_key->{exp_type
},
85 'key type ' . $key->type . " sanitized as $ref_key->{exp_type}");
86 is
($key->handle, $ref_key->{exp_handle
},
87 'key handle ' . $key->handle . " sanitized as $ref_key->{exp_handle}");
90 # TODO: Add actual test cases.