]> Sergey Matveev's repositories - public-inbox.git/blob - t/sha.t
tests: make require_git and require_cmd easier-to-use
[public-inbox.git] / t / sha.t
1 #!perl -w
2 # Copyright (C) all contributors <meta@public-inbox.org>
3 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 use v5.12;
5 use PublicInbox::SHA;
6 use Test::More;
7
8 {
9         my $dig = PublicInbox::SHA->new(1);
10         open my $fh, '<', 'COPYING' or die "open: $!";
11         $dig->add(do { local $/; <$fh> });
12         is($dig->hexdigest, '78e50e186b04c8fe1defaa098f1c192181b3d837',
13                 'AGPL-3 matches');
14 }
15
16 SKIP: {
17         my $n = $ENV{TEST_LEAK_NR} or skip 'TEST_LEAK_NR unset', 1;
18         for (1..$n) {
19                 PublicInbox::SHA->new(1)->add('hello')->digest;
20                 PublicInbox::SHA->new(1)->add('hello');
21                 PublicInbox::SHA->new(1);
22         }
23 }
24
25 done_testing;