/
long_line_and_encoding_cases.t
29 lines (23 loc) · 1.38 KB
/
long_line_and_encoding_cases.t
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
use v6;
use Test;
use PP::Enc::MIME::Base64;
plan 7;
is encode_base64_str(
'This is a long line whose base64 encoding should be broken into multiple lines as required by MIME.'),
"VGhpcyBpcyBhIGxvbmcgbGluZSB3aG9zZSBiYXNlNjQgZW5jb2Rpbmcgc2hvdWxkIGJlIGJyb2tl
biBpbnRvIG11bHRpcGxlIGxpbmVzIGFzIHJlcXVpcmVkIGJ5IE1JTUUu",
'Encode Break up long line test';
is encode_base64_str(
'This is a long line whose base64 encoding should be broken into multiple lines as required by MIME.', eol => ''),
"VGhpcyBpcyBhIGxvbmcgbGluZSB3aG9zZSBiYXNlNjQgZW5jb2Rpbmcgc2hvdWxkIGJlIGJyb2tlbiBpbnRvIG11bHRpcGxlIGxpbmVzIGFzIHJlcXVpcmVkIGJ5IE1JTUUu",
'Encode Break up long line test with breakup override';
is decode_base64_str(
"VGhpcyBpcyBhIGxvbmcgbGluZSB3aG9zZSBiYXNlNjQgZW5jb2Rpbmcgc2hvdWxkIGJlIGJyb2tl
biBpbnRvIG11bHRpcGxlIGxpbmVzIGFzIHJlcXVpcmVkIGJ5IE1JTUUu"),
'This is a long line whose base64 encoding should be broken into multiple lines as required by MIME.',
'Decode Break up long line test';
my $screen_w_accent_e = chr(233) ~ "cran";
is encode_base64_str($screen_w_accent_e, 'iso-8859-1'), '6WNyYW4=', 'latin-1 string encoding test';
is decode_base64_str('6WNyYW4=', 'iso-8859-1'), $screen_w_accent_e, 'latin-1 string decoding test';
is encode_base64_str($screen_w_accent_e), 'w6ljcmFu', 'utf-8 string encoding test';
is decode_base64_str('w6ljcmFu'), $screen_w_accent_e, 'utf-8 string decoding test';