Skip to content

Commit

Permalink
Convert all tests to use Test::More rather than Test.pm
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg authored and mbeijen committed Jan 9, 2025
1 parent 77c59be commit 4080469
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 42 deletions.
1 change: 0 additions & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ my %WriteMakefileArgs = (
"TEST_REQUIRES" => {
"ExtUtils::MakeMaker" => 0,
"File::Spec" => 0,
"Test" => 0,
"Test::More" => 0,
"strict" => 0,
"warnings" => 0
Expand Down
6 changes: 3 additions & 3 deletions t/base64url.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use strict;
use warnings;
use Test qw(plan ok);
use Test::More;

use MIME::Base64 qw(encode_base64url decode_base64url);

Expand All @@ -18,8 +18,8 @@ plan tests => 2 * @tests;
for (@tests) {
my($name, $input, $output) = @$_;
print "# $name\n";
ok(decode_base64url($input), $output);
ok(encode_base64url($output), $input);
is(decode_base64url($input), $output);
is(encode_base64url($output), $input);
}

__END__
Expand Down
70 changes: 34 additions & 36 deletions t/length.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,47 @@

use strict;
use warnings;
use Test qw(plan ok);

plan tests => 129;
use Test::More tests => 129;

use MIME::Base64 qw(encode_base64 encoded_base64_length decoded_base64_length);
*elen = *encoded_base64_length;
*dlen = *decoded_base64_length;

ok(elen(""), 0);
ok(elen("a"), 5);
ok(elen("aa"), 5);
ok(elen("aaa"), 5);
ok(elen("aaaa"), 9);
ok(elen("aaaaa"), 9);

ok(elen("", ""), 0);
ok(elen("a", ""), 4);
ok(elen("aa", ""), 4);
ok(elen("aaa", ""), 4);
ok(elen("aaaa", ""), 8);
ok(elen("aaaaa", ""), 8);

ok(dlen(""), 0);
ok(dlen("a"), 0);
ok(dlen("aa"), 1);
ok(dlen("aaa"), 2);
ok(dlen("aaaa"), 3);
ok(dlen("aaaaa"), 3);
ok(dlen("aaaaaa"), 4);
ok(dlen("aaaaaaa"), 5);
ok(dlen("aaaaaaaa"), 6);

ok(dlen("=aaaa"), 0);
ok(dlen("a=aaa"), 0);
ok(dlen("aa=aa"), 1);
ok(dlen("aaa=a"), 2);
ok(dlen("aaaa="), 3);

ok(dlen("a\na\na a"), 3);
is(elen(""), 0);
is(elen("a"), 5);
is(elen("aa"), 5);
is(elen("aaa"), 5);
is(elen("aaaa"), 9);
is(elen("aaaaa"), 9);

is(elen("", ""), 0);
is(elen("a", ""), 4);
is(elen("aa", ""), 4);
is(elen("aaa", ""), 4);
is(elen("aaaa", ""), 8);
is(elen("aaaaa", ""), 8);

is(dlen(""), 0);
is(dlen("a"), 0);
is(dlen("aa"), 1);
is(dlen("aaa"), 2);
is(dlen("aaaa"), 3);
is(dlen("aaaaa"), 3);
is(dlen("aaaaaa"), 4);
is(dlen("aaaaaaa"), 5);
is(dlen("aaaaaaaa"), 6);

is(dlen("=aaaa"), 0);
is(dlen("a=aaa"), 0);
is(dlen("aa=aa"), 1);
is(dlen("aaa=a"), 2);
is(dlen("aaaa="), 3);

is(dlen("a\na\na a"), 3);

for my $i (50..100) {
my $a = "a" x $i;
my $a_enc = encode_base64($a);
ok(elen($a), length($a_enc));
ok(dlen($a_enc), $i);
is(elen($a), length($a_enc));
is(dlen($a_enc), $i);
}
3 changes: 1 addition & 2 deletions t/unicode.t
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use strict;
use warnings;

use Test;
plan tests => 11;
use Test::More tests => 11;

require MIME::Base64;
require MIME::QuotedPrint;
Expand Down

0 comments on commit 4080469

Please sign in to comment.