File: Ranges.pm

package info (click to toggle)
libhttp-exception-perl 0.04007-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, forky, sid, trixie
  • size: 300 kB
  • sloc: perl: 232; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 844 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
package Test::HTTP::Exception::Ranges;
use strict;
use Test::More;

################################################################################
sub test_range_ok {
    my @ranges = @_;
    s/XX$/00/ for (@ranges);
    my %instantiable;
    @instantiable{@ranges} = ();

    for my $status_code (100, 200, 300, 400, 500) {
        my $e;
        eval { $e = "HTTP::Exception::$status_code"->new; };

        if (exists $instantiable{$status_code}) {
            ok defined $e, "$status_code is instantiable";
        } else {
            ok !defined $e, "$status_code is not instantiable";
        }
    }
}

################################################################################
sub simple_test_range_ok {
    my @ranges = @_;

    require HTTP::Exception;
    HTTP::Exception->import(@ranges);

    test_range_ok(@ranges);
}

1;