Assert-Conditional

 view release on metacpan or  search on metacpan

lib/Assert/Conditional.pm  view on Meta::CPAN

sub  assert_hash_keys                         ( \% @              ) ;
sub  assert_hash_keys_allowed                 ( \% @              ) ;
sub  assert_hash_keys_allowed_and_required    ( \% $ $            ) ;
sub  assert_hash_keys_required                ( \% @              ) ;
sub  assert_hash_keys_required_and_allowed    ( \% $ $            ) ;
sub  assert_hash_nonempty                     ( \%                ) ;
sub  assert_hashref                           (  $                ) ;
sub  assert_hashref_keys                      (  $@               ) ;
sub  assert_hashref_keys_allowed              (  $@               ) ;
sub  assert_hashref_keys_allowed_and_required (  $$$              ) ;
sub  assert_hashref_keys_required             (  $@               ) ;
sub  assert_hashref_keys_required_and_allowed (  $$$              ) ;
sub  assert_hashref_nonempty                  (  $                ) ;
sub  assert_hex_number                        (  $                ) ;
sub  assert_in_list                           (  $@               ) ;
sub  assert_in_numeric_range                  (  $$$              ) ;
sub  assert_integer                           (  $                ) ;
sub  assert_ioref                             (  $                ) ;
sub  assert_is                                (  $$               ) ;
sub  assert_isa                               (  $@               ) ;
sub  assert_isnt                              (  $$               ) ;
sub  assert_keys                              ( \[%$] @           ) ;
sub  assert_known_package                     (  $                ) ;
sub  assert_latin1                            (  $                ) ;
sub  assert_latinish                          (  $                ) ;
sub  assert_legal_exit_status                 ( ;$                ) ;
sub  assert_like                              (  $$               ) ;
sub  assert_list_context                      (                   ) ;
sub  assert_list_nonempty                     (  @                ) ;
sub  assert_locked                            ( \[%$] @           ) ;
sub  assert_lowercased                        (  $                ) ;
sub  assert_max_keys                          ( \[%$] @           ) ;
sub  assert_method                            (                   ) ;
sub  assert_min_keys                          ( \[%$] @           ) ;
sub  assert_minmax_keys                       ( \[%$] \[@$] \[@$] ) ;
sub  assert_multi_line                        (  $                ) ;
sub  assert_natural_number                    (  $                ) ;
sub  assert_negative                          (  $                ) ;
sub  assert_negative_integer                  (  $                ) ;
sub  assert_nfc                               (  $                ) ;
sub  assert_nfd                               (  $                ) ;
sub  assert_nfkc                              (  $                ) ;
sub  assert_nfkd                              (  $                ) ;
sub  assert_no_coredump                       ( ;$                ) ;
sub  assert_nonalphabetic                     (  $                ) ;
sub  assert_nonascii                          (  $                ) ;
sub  assert_nonastral                         (  $                ) ;
sub  assert_nonblank                          (  $                ) ;
sub  assert_nonbytes                          (  $                ) ;
sub  assert_nonempty                          (  $                ) ;
sub  assert_nonlist_context                   (                   ) ;
sub  assert_nonnegative                       (  $                ) ;
sub  assert_nonnegative_integer               (  $                ) ;
sub  assert_nonnumeric                        (  $                ) ;
sub  assert_nonobject                         (  $                ) ;
sub  assert_nonpositive                       (  $                ) ;
sub  assert_nonpositive_integer               (  $                ) ;
sub  assert_nonref                            (  $                ) ;
sub  assert_nonvoid_context                   (                   ) ;
sub  assert_nonzero                           (  $                ) ;
sub  assert_not_in_list                       (  $@               ) ;
sub  assert_numeric                           (  $                ) ;
sub  assert_object                            (  $                ) ;
sub  assert_object_ainta                      (  $@               ) ;
sub  assert_object_boolifies                  (  $                ) ;
sub  assert_object_can                        (  $@               ) ;
sub  assert_object_cant                       (  $@               ) ;
sub  assert_object_isa                        (  $@               ) ;
sub  assert_object_method                     (                   ) ;
sub  assert_object_nummifies                  (  $                ) ;
sub  assert_object_overloads                  (  $@               ) ;
sub  assert_object_stringifies                (  $                ) ;
sub  assert_odd_number                        (  $                ) ;
sub  assert_open_handle                       (  $                ) ;
sub  assert_positive                          (  $                ) ;
sub  assert_positive_integer                  (  $                ) ;
sub  assert_private_method                    (                   ) ;
sub  assert_protected_method                  (                   ) ;
sub  assert_public_method                     (                   ) ;
sub  assert_qualified_ident                   (  $                ) ;
sub  assert_refref                            (  $                ) ;
sub  assert_reftype                           (  $$               ) ;
sub  assert_regex                             (  $                ) ;
sub  assert_regular_file                      (  $                ) ;
sub  assert_sad_exit                          ( ;$                ) ;
sub  assert_scalar_context                    (                   ) ;
sub  assert_scalarref                         (  $                ) ;
sub  assert_signalled                         ( ;$                ) ;
sub  assert_signed_number                     (  $                ) ;
sub  assert_simple_perl_ident                 (  $                ) ;
sub  assert_single_line                       (  $                ) ;
sub  assert_single_paragraph                  (  $                ) ;
sub  assert_text_file                         (  $                ) ;
sub  assert_tied                              ( \[$@%*]           ) ;
sub  assert_tied_array                        ( \@                ) ;
sub  assert_tied_arrayref                     (  $                ) ;
sub  assert_tied_glob                         ( \*                ) ;
sub  assert_tied_globref                      (  $                ) ;
sub  assert_tied_hash                         ( \%                ) ;
sub  assert_tied_hashref                      (  $                ) ;
sub  assert_tied_referent                     (  $                ) ;
sub  assert_tied_scalar                       ( \$                ) ;
sub  assert_tied_scalarref                    (  $                ) ;
sub  assert_true                              (  $                ) ;
sub  assert_unblessed_ref                     (  $                ) ;
sub  assert_undefined                         (  $                ) ;
sub  assert_unhappy_code                      (  &                ) ;
sub  assert_unicode_ident                     (  $                ) ;
sub  assert_unlike                            (  $$               ) ;
sub  assert_unlocked                          ( \[%$] @           ) ;
sub  assert_unsignalled                       ( ;$                ) ;
sub  assert_untied                            ( \[$@%*]           ) ;
sub  assert_untied_array                      ( \@                ) ;
sub  assert_untied_arrayref                   (  $                ) ;
sub  assert_untied_glob                       ( \*                ) ;
sub  assert_untied_globref                    (  $                ) ;
sub  assert_untied_hash                       ( \%                ) ;
sub  assert_untied_hashref                    (  $                ) ;
sub  assert_untied_referent                   (  $                ) ;
sub  assert_untied_scalar                     ( \$                ) ;
sub  assert_untied_scalarref                  (  $                ) ;

lib/Assert/Conditional.pm  view on Meta::CPAN

sub assert_nfc($)
    :Assert( qw[unicode] )
{
    my($str) = @_;
    checkNFC($str) // $str eq NFC($str)
                                || botch "string not in NFC form";
}

sub assert_nfkc($)
    :Assert( qw[unicode] )
{
    my($str) = @_;
    checkNFKC($str) // $str eq NFKC($str)
                                || botch "string not in NFKC form";
}

sub assert_nfd($)
    :Assert( qw[unicode] )
{
    my($str) = @_;
    checkNFD($str)              || botch "string not in NFD form";
}

sub assert_nfkd($)
    :Assert( qw[unicode] )
{
    my($str) = @_;
    checkNFKD($str)              || botch "string not in NFKD form";
}

sub assert_eq($$)
    :Assert( qw[string unicode] )
{
    my($this, $that) = @_;
    NFC($this) eq NFC($that)    || botch "'$this' and '$that' are not equivalent Unicode strings";
}

sub assert_eq_letters($$)
    :Assert( qw[string unicode] )
{
    my($this, $that) = @_;
    UCA1($this) eq UCA1($that)  || botch "'$this' and '$that' do not equivalent letters"
}

sub assert_in_list($@)
    :Assert( qw[list] )
{
    my($needle, @haystack) = @_;
    #assert_nonref($needle);
    my $undef_needle = !defined($needle);
    for my $straw (@haystack) {
        #assert_nonref($straw);
        return if $undef_needle
            ? !defined($straw)
            : ("$needle" eq (defined($straw) && "$straw"))
    }
    $needle = "undef" unless defined $needle;
    botch "couldn't find $needle in " . join(", " => map { defined() ? $_ : "undef" } @haystack);
}

sub assert_not_in_list($@)
    :Assert( qw[list] )
{
    my($needle, @haystack) = @_;
    my $found = 0;
    for my $straw (@haystack) {
        if (defined $needle) {
            next if !defined $straw;
            if ("$needle" eq "$straw") {
                $found = 1;
                last;
            }
        } else {
            next if defined $straw;
            $found = 1;
            last;
        }
    }
    return unless $found;
    $needle = "undef" unless defined $needle;
    botch "found $needle in forbidden list";
}

sub assert_list_nonempty( @ )
    :Assert( qw[list array] )
{
    @_                          || botch "list is empty";
}

sub assert_array_nonempty( \@ )
    :Assert( qw[array] )
{
    &assert_arrayref_nonempty;
}

sub assert_arrayref_nonempty( $ )
    :Assert( qw[array] )
{
    &assert_array_length;
    my($aref) = @_;
    assert_arrayref($aref);
    my $count = @$aref;
    $count > 0  || botch("array is empty");
}

sub assert_array_length( \@ ;$ )
    :Assert( qw[array] )
{
    if (@_ == 1) {
        assert_array_length_min(@{$_[0]} => 1);
        return;
    }
    my($aref, $want) = @_;
    assert_arrayref($aref);
    assert_whole_number($want);
    my $have  = @$aref;
    $have == $want            || botch_array_length($have, $want);
}

sub assert_array_length_min( \@ $ )
    :Assert( qw[array] )

lib/Assert/Conditional.pm  view on Meta::CPAN

 assert_hash_keys                         ( \% @    ) ;
 assert_hash_keys_allowed                 ( \% @    ) ;
 assert_hash_keys_allowed_and_required    ( \% $ $  ) ;
 assert_hash_keys_required                ( \% @    ) ;
 assert_hash_keys_required_and_allowed    ( \% $ $  ) ;
 assert_hash_nonempty                     ( \%      ) ;
 assert_hashref                           (  $      ) ;
 assert_hashref_keys                      (  $@     ) ;
 assert_hashref_keys_allowed              (  $@     ) ;
 assert_hashref_keys_allowed_and_required (  $$$    ) ;
 assert_hashref_keys_required             (  $@     ) ;
 assert_hashref_keys_required_and_allowed (  $$$    ) ;
 assert_hashref_nonempty                  (  $      ) ;
 assert_hex_number                        (  $      ) ;
 assert_in_list                           (  $@     ) ;
 assert_in_numeric_range                  (  $$$    ) ;
 assert_integer                           (  $      ) ;
 assert_ioref                             (  $      ) ;
 assert_is                                (  $$     ) ;
 assert_isa                               (  $@     ) ;
 assert_isnt                              (  $$     ) ;
 assert_keys                              ( \[%$] @ ) ;
 assert_known_package                     (  $      ) ;
 assert_latin1                            (  $      ) ;
 assert_latinish                          (  $      ) ;
 assert_legal_exit_status                 ( ;$      ) ;
 assert_like                              (  $$     ) ;
 assert_list_context                      (         ) ;
 assert_list_nonempty                     (  @      ) ;
 assert_locked                            ( \[%$] @ ) ;
 assert_lowercased                        (  $      ) ;
 assert_max_keys                          ( \[%$] @ ) ;
 assert_method                            (         ) ;
 assert_min_keys                          ( \[%$] @ ) ;
 assert_minmax_keys                       ( \[%$] \[@$] \[@$] ) ;
 assert_multi_line                        (  $   ) ;
 assert_natural_number                    (  $   ) ;
 assert_negative                          (  $   ) ;
 assert_negative_integer                  (  $   ) ;
 assert_nfc                               (  $   ) ;
 assert_nfd                               (  $   ) ;
 assert_nfkc                              (  $   ) ;
 assert_nfkd                              (  $   ) ;
 assert_no_coredump                       ( ;$   ) ;
 assert_nonalphabetic                     (  $   ) ;
 assert_nonascii                          (  $   ) ;
 assert_nonastral                         (  $   ) ;
 assert_nonblank                          (  $   ) ;
 assert_nonbytes                          (  $   ) ;
 assert_nonempty                          (  $   ) ;
 assert_nonlist_context                   (      ) ;
 assert_nonnegative                       (  $   ) ;
 assert_nonnegative_integer               (  $   ) ;
 assert_nonnumeric                        (  $   ) ;
 assert_nonobject                         (  $   ) ;
 assert_nonpositive                       (  $   ) ;
 assert_nonpositive_integer               (  $   ) ;
 assert_nonref                            (  $   ) ;
 assert_nonvoid_context                   (      ) ;
 assert_nonzero                           (  $   ) ;
 assert_not_in_list                       (  $@  ) ;
 assert_numeric                           (  $   ) ;
 assert_object                            (  $   ) ;
 assert_object_ainta                      (  $@  ) ;
 assert_object_boolifies                  (  $   ) ;
 assert_object_can                        (  $@  ) ;
 assert_object_cant                       (  $@  ) ;
 assert_object_isa                        (  $@  ) ;
 assert_object_method                     (      ) ;
 assert_object_nummifies                  (  $   ) ;
 assert_object_overloads                  (  $@  ) ;
 assert_object_stringifies                (  $   ) ;
 assert_odd_number                        (  $   ) ;
 assert_open_handle                       (  $   ) ;
 assert_positive                          (  $   ) ;
 assert_positive_integer                  (  $   ) ;
 assert_private_method                    (      ) ;
 assert_protected_method                  (      ) ;
 assert_public_method                     (      ) ;
 assert_qualified_ident                   (  $   ) ;
 assert_refref                            (  $   ) ;
 assert_reftype                           (  $$  ) ;
 assert_regex                             (  $   ) ;
 assert_regular_file                      (  $   ) ;
 assert_sad_exit                          ( ;$   ) ;
 assert_scalar_context                    (      ) ;
 assert_scalarref                         (  $   ) ;
 assert_signalled                         ( ;$   ) ;
 assert_signed_number                     (  $   ) ;
 assert_simple_perl_ident                 (  $   ) ;
 assert_single_line                       (  $   ) ;
 assert_single_paragraph                  (  $   ) ;
 assert_text_file                         (  $   ) ;
 assert_tied                              ( \[$@*]  ) ;
 assert_tied_array                        ( \@  ) ;
 assert_tied_arrayref                     (  $  ) ;
 assert_tied_glob                         ( \*  ) ;
 assert_tied_globref                      (  $  ) ;
 assert_tied_hash                         ( \%  ) ;
 assert_tied_hashref                      (  $  ) ;
 assert_tied_referent                     (  $  ) ;
 assert_tied_scalar                       ( \$  ) ;
 assert_tied_scalarref                    (  $  ) ;
 assert_true                              (  $  ) ;
 assert_unblessed_ref                     (  $  ) ;
 assert_undefined                         (  $  ) ;
 assert_unhappy_code                      (  &  ) ;
 assert_unicode_ident                     (  $  ) ;
 assert_unlike                            (  $$ ) ;
 assert_unlocked                          ( \[%$] @  ) ;
 assert_unsignalled                       ( ;$       ) ;
 assert_untied                            ( \[$@%*]  ) ;
 assert_untied_array                      ( \@  ) ;
 assert_untied_arrayref                   (  $  ) ;
 assert_untied_glob                       ( \*  ) ;
 assert_untied_globref                    (  $  ) ;
 assert_untied_hash                       ( \%  ) ;
 assert_untied_hashref                    (  $  ) ;
 assert_untied_referent                   (  $  ) ;
 assert_untied_scalar                     ( \$  ) ;
 assert_untied_scalarref                  (  $  ) ;
 assert_uppercased                        (  $  ) ;
 assert_void_context                      (     ) ;
 assert_whole_number                      (  $  ) ;
 assert_wide_characters                   (  $  ) ;
 assert_zero                              (  $  ) ;

All assertions have function prototypes; this helps you use them correctly,
and in some cases casts the argument into scalar context, adds backslashes
to pass things by reference, so you don't have to.

=head2 Export Tags

You may import all assertions or just some of them.  When importing only
some of them, you may wish to use an export tag to import a set of related
assertions.  Here is what each tag imports:

=over

=item C<:all>

L</assert_ainta>, L</assert_alnum>, L</assert_alphabetic>,
L</assert_anyref>, L</assert_argc>, L</assert_argc_max>,
L</assert_argc_min>, L</assert_argc_minmax>, L</assert_array_length>,
L</assert_array_length_max>, L</assert_array_length_min>,
L</assert_array_length_minmax>, L</assert_array_nonempty>,
L</assert_arrayref>, L</assert_arrayref_nonempty>, L</assert_ascii>,
L</assert_ascii_ident>, L</assert_astral>, L</assert_blank>,
L</assert_bmp>, L</assert_box_number>, L</assert_bytes>, L</assert_can>,
L</assert_cant>, L</assert_class_ainta>, L</assert_class_can>,
L</assert_class_cant>, L</assert_class_isa>, L</assert_class_method>,
L</assert_coderef>, L</assert_defined>, L</assert_defined_value>,
L</assert_defined_variable>, L</assert_digits>, L</assert_directory>,
L</assert_does>, L</assert_doesnt>, L</assert_dumped_core>,
L</assert_empty>, L</assert_eq>, L</assert_eq_letters>,
L</assert_even_number>, L</assert_exited>, L</assert_false>,
L</assert_fractional>, L</assert_full_perl_ident>, L</assert_globref>,
L</assert_happy_code>, L</assert_happy_exit>, L</assert_hash_keys>,
L</assert_hash_keys_allowed>, L</assert_hash_keys_allowed_and_required>,
L</assert_hash_keys_required>, L</assert_hash_keys_required_and_allowed>,
L</assert_hash_nonempty>, L</assert_hashref>, L</assert_hashref_keys>,
L</assert_hashref_keys_allowed>,
L</assert_hashref_keys_allowed_and_required>,
L</assert_hashref_keys_required>,
L</assert_hashref_keys_required_and_allowed>, L</assert_hashref_nonempty>,
L</assert_hex_number>, L</assert_in_list>, L</assert_in_numeric_range>,
L</assert_integer>, L</assert_ioref>, L</assert_is>, L</assert_isa>,
L</assert_isnt>, L</assert_keys>, L</assert_known_package>,
L</assert_latin1>, L</assert_latinish>, L</assert_legal_exit_status>,
L</assert_like>, L</assert_list_context>, L</assert_list_nonempty>,
L</assert_locked>, L</assert_lowercased>, L</assert_max_keys>,
L</assert_method>, L</assert_min_keys>, L</assert_minmax_keys>,
L</assert_multi_line>, L</assert_natural_number>, L</assert_negative>,
L</assert_negative_integer>, L</assert_nfc>, L</assert_nfd>,
L</assert_nfkc>, L</assert_nfkd>, L</assert_no_coredump>,
L</assert_nonalphabetic>, L</assert_nonascii>, L</assert_nonastral>,
L</assert_nonblank>, L</assert_nonbytes>, L</assert_nonempty>,
L</assert_nonlist_context>, L</assert_nonnegative>,
L</assert_nonnegative_integer>, L</assert_nonnumeric>,
L</assert_nonobject>, L</assert_nonpositive>,
L</assert_nonpositive_integer>, L</assert_nonref>,
L</assert_nonvoid_context>, L</assert_nonzero>, L</assert_not_in_list>,
L</assert_numeric>, L</assert_object>, L</assert_object_ainta>,
L</assert_object_boolifies>, L</assert_object_can>, L</assert_object_cant>,
L</assert_object_isa>, L</assert_object_method>,
L</assert_object_nummifies>, L</assert_object_overloads>,
L</assert_object_stringifies>, L</assert_odd_number>,
L</assert_open_handle>, L</assert_positive>, L</assert_positive_integer>,
L</assert_private_method>, L</assert_protected_method>,
L</assert_public_method>, L</assert_qualified_ident>, L</assert_refref>,
L</assert_reftype>, L</assert_regex>, L</assert_regular_file>,
L</assert_sad_exit>, L</assert_scalar_context>, L</assert_scalarref>,
L</assert_signalled>, L</assert_signed_number>,
L</assert_simple_perl_ident>, L</assert_single_line>,
L</assert_single_paragraph>, L</assert_text_file>, L</assert_tied>,
L</assert_tied_array>, L</assert_tied_arrayref>, L</assert_tied_glob>,
L</assert_tied_globref>, L</assert_tied_hash>, L</assert_tied_hashref>,
L</assert_tied_referent>, L</assert_tied_scalar>,
L</assert_tied_scalarref>, L</assert_true>, L</assert_unblessed_ref>,
L</assert_undefined>, L</assert_unhappy_code>, L</assert_unicode_ident>,
L</assert_unlike>, L</assert_unlocked>, L</assert_unsignalled>,
L</assert_untied>, L</assert_untied_array>, L</assert_untied_arrayref>,
L</assert_untied_glob>, L</assert_untied_globref>, L</assert_untied_hash>,
L</assert_untied_hashref>, L</assert_untied_referent>,
L</assert_untied_scalar>, L</assert_untied_scalarref>,
L</assert_uppercased>, L</assert_void_context>, L</assert_whole_number>,
L</assert_wide_characters>, and L</assert_zero>.

=item C<:argc>

L</assert_argc>, L</assert_argc_max>, L</assert_argc_min>, and
L</assert_argc_minmax>.

=item C<:array>

L</assert_array_length>, L</assert_array_length_max>,
L</assert_array_length_min>, L</assert_array_length_minmax>,
L</assert_array_nonempty>, L</assert_arrayref>,
L</assert_arrayref_nonempty>, L</assert_list_nonempty>,
L</assert_tied_array>, L</assert_tied_arrayref>, L</assert_untied_array>,
and L</assert_untied_arrayref>.

=item C<:boolean>

L</assert_false>, L</assert_happy_code>, L</assert_true>, and
L</assert_unhappy_code>.

=item C<:case>

L</assert_lowercased> and L</assert_uppercased>.

=item C<:code>

L</assert_coderef>, L</assert_happy_code>, and L</assert_unhappy_code>.

=item C<:context>

L</assert_list_context>, L</assert_nonlist_context>,
L</assert_nonvoid_context>, L</assert_scalar_context>, and
L</assert_void_context>.

=item C<:file>

L</assert_directory>, L</assert_open_handle>, L</assert_regular_file>,
and L</assert_text_file>.

=item C<:glob>

L</assert_globref>, L</assert_tied_glob>, L</assert_tied_globref>,
L</assert_untied_glob>, and L</assert_untied_globref>.

=item C<:hash>

L</assert_hash_keys>, L</assert_hash_keys_allowed>,
L</assert_hash_keys_allowed_and_required>, L</assert_hash_keys_required>,
L</assert_hash_keys_required_and_allowed>, L</assert_hash_nonempty>,
L</assert_hashref>, L</assert_hashref_keys>,
L</assert_hashref_keys_allowed>,
L</assert_hashref_keys_allowed_and_required>,
L</assert_hashref_keys_required>,
L</assert_hashref_keys_required_and_allowed>, L</assert_hashref_nonempty>,
L</assert_keys>, L</assert_locked>, L</assert_max_keys>,
L</assert_min_keys>, L</assert_minmax_keys>, L</assert_tied_hash>,
L</assert_tied_hashref>, L</assert_unlocked>, L</assert_untied_hash>,
and L</assert_untied_hashref>.

=item C<:ident>

L</assert_ascii_ident>, L</assert_full_perl_ident>,
L</assert_known_package>, L</assert_qualified_ident>, and
L</assert_simple_perl_ident>.

=item C<:io>

L</assert_ioref> and L</assert_open_handle>.

=item C<:list>

L</assert_in_list>, L</assert_list_nonempty>, and L</assert_not_in_list>.

=item C<:number>

L</assert_box_number>, L</assert_digits>, L</assert_even_number>,
L</assert_fractional>, L</assert_hex_number>, L</assert_in_numeric_range>,
L</assert_integer>, L</assert_natural_number>, L</assert_negative>,
L</assert_negative_integer>, L</assert_nonnegative>,
L</assert_nonnegative_integer>, L</assert_nonnumeric>,
L</assert_nonpositive>, L</assert_nonpositive_integer>, L</assert_nonzero>,
L</assert_numeric>, L</assert_odd_number>, L</assert_positive>,
L</assert_positive_integer>, L</assert_signed_number>,
L</assert_whole_number>, and L</assert_zero>.

=item C<:object>

L</assert_ainta>, L</assert_can>, L</assert_cant>, L</assert_class_ainta>,
L</assert_class_can>, L</assert_class_cant>, L</assert_class_isa>,
L</assert_class_method>, L</assert_does>, L</assert_doesnt>,
L</assert_isa>, L</assert_known_package>, L</assert_method>,
L</assert_nonobject>, L</assert_object>, L</assert_object_ainta>,
L</assert_object_boolifies>, L</assert_object_can>, L</assert_object_cant>,
L</assert_object_isa>, L</assert_object_method>,
L</assert_object_nummifies>, L</assert_object_overloads>,
L</assert_object_stringifies>, L</assert_private_method>,
L</assert_protected_method>, L</assert_public_method>, L</assert_reftype>,
and L</assert_unblessed_ref>.

=item C<:overload>

L</assert_object_boolifies>, L</assert_object_nummifies>,
L</assert_object_overloads>, and L</assert_object_stringifies>.

=item C<:process>

L</assert_dumped_core>, L</assert_exited>, L</assert_happy_exit>,
L</assert_legal_exit_status>, L</assert_no_coredump>, L</assert_sad_exit>,
L</assert_signalled>, and L</assert_unsignalled>.

=item C<:ref>

L</assert_anyref>, L</assert_arrayref>, L</assert_coderef>,
L</assert_globref>, L</assert_hashref>, L</assert_ioref>,
L</assert_nonref>, L</assert_refref>, L</assert_reftype>,
L</assert_scalarref>, L</assert_tied_arrayref>, L</assert_tied_globref>,
L</assert_tied_hashref>, L</assert_tied_referent>,
L</assert_tied_scalarref>, L</assert_unblessed_ref>,
L</assert_untied_arrayref>, L</assert_untied_globref>,
L</assert_untied_hashref>, L</assert_untied_referent>, and
L</assert_untied_scalarref>.

=item C<:regex>

L</assert_alnum>, L</assert_alphabetic>, L</assert_ascii>,
L</assert_ascii_ident>, L</assert_blank>, L</assert_digits>,
L</assert_full_perl_ident>, L</assert_hex_number>, L</assert_like>,
L</assert_lowercased>, L</assert_multi_line>, L</assert_nonalphabetic>,
L</assert_nonascii>, L</assert_nonblank>, L</assert_qualified_ident>,
L</assert_regex>, L</assert_simple_perl_ident>, L</assert_single_line>,
L</assert_single_paragraph>, L</assert_unicode_ident>, L</assert_unlike>,
and L</assert_uppercased>.

lib/Assert/Conditional.pm  view on Meta::CPAN

=item assert_nonastral(I<ARG>)

Argument contains only code points
from U+0000 through U+FFFF.

=item assert_bmp(I<ARG>)

An alias for L</assert_nonastral>.

The argument contains only code points in the
Basic Multilingual Plain; that is, in Plane 0.

=item assert_nfc(I<ARG>)

The argument is in Unicode Normalization Form C,
formed by canonical I<B<de>composition> followed by
canonical composition.

=item assert_nfkc(I<ARG>)

The argument is in Unicode Normalization Form KC,
formed by compatible I<B<de>composition> followed by
compatible composition.

=item assert_nfd(I<ARG>)

The argument is in Unicode Normalization Form D,
formed by canonical I<B<de>composition>.

=item assert_nfkd(I<ARG>)

The argument is in Unicode Normalization Form KD,
formed by compatible I<B<de>composition>.

=item assert_eq(I<THIS>, I<THAT>)

The two strings have the same NFC forms using the C<eq>
operator.  This means that default ignorable code points
will throw of the equality check.

This is not the same as L</assert_is>.  You may well
want the next assertion instead.

=item assert_eq_letters(I<THIS>, I<THAT>)

The two strings test equal when considered only at the primary strength
(letters only) using the Unicode Collation Algorithm.  That means that case
(whether upper-, lower-, or titecase), non-letters, and combining marks are
ignored, as are other default ignorable code points.

=back

=head2 Assertions about Lists

=over

=item assert_in_list(I<STRING>, I<LIST>)

The first argument must occur in the list following it.

=item assert_not_in_list(I<STRING>, I<LIST>)

The first argument must not occur in the list following it.

=item assert_list_nonempty(I<LIST>)

The list must have at least one element, although that
element does not have to nonblank or even defined.

=back

=head2 Assertions about Arrays

=over

=item assert_array_nonempty( I<ARRAY> )

The array must at least one element.

=item assert_arrayref_nonempty( I<ARRAYREF> )

The array reference must refer to an existing array with
at least one element.

=item assert_array_length(I<ARRAY>, [ I<LENGTH> ])

The array must have the number of elements specified
in the optional second argument.  If the second
argument is omitted, any non-zero length will do.

=item assert_array_length_min(I<ARRAY>, I<MIN_ELEMENTS>)

The array must have at least as many elements as specified
by the number in the second argument.

=item assert_array_length_max(I<ARRAY>, I<MAX_ELEMENTS>)

The array must have no more elements than the number specified
in the second argument.

=item assert_array_length_minmax(I<ARRAY>, I<MIN_ELEMENTS>, I<MAX_ELEMENTS>)

The array must have at least as many elements as the number given in the
second element, but no more than the one in the third.

=back

=head2 Assertions about Argument Counts

B<WARNING:> These assertions are incompatible with L<Test::Exception> because
they inspect their C<caller>'s args via C<@DB::args>, and that module wipes
those out from visibility.

=over

=item assert_argc()

=item assert_argc(I<COUNT>)

=for comment
This is a workaround to create a "blank" line so that the code sample is distinct.



( run in 1.212 second using v1.01-cache-2.11-cpan-39bf76dae61 )