File: 004_custom_base64.t

package info (click to toggle)
libcrypt-format-perl 0.09-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 116 kB
  • sloc: perl: 39; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 601 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use Test::More;

plan tests => 2;

use Crypt::Format;

{
    local $INC{'BadBase64.pm'} = __FILE__;
    local $Crypt::Format::BASE64_MODULE = 'BadBase64';

    my $faux_pem = "-----BEGIN XXX-----\nencoded\n-----END XXX-----";

    is(
        Crypt::Format::der2pem(0000, 'XXX'),
        $faux_pem,
        'der2pem() (encode())',
    );

    is(
        Crypt::Format::pem2der($faux_pem),
        'decoded',
        'pem2der() (decode())',
    );
}

#----------------------------------------------------------------------

package BadBase64;

sub encode { "encoded\n" }

sub decode { 'decoded' }

1;