File: 43-bag-on-empty.t

package info (click to toggle)
libtest2-suite-perl 0.000118-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,608 kB
  • sloc: perl: 6,198; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 416 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use Test2::Bundle::Extended;

my $got = intercept {
    my $check = bag {
        item 'a';
        item 'b';
        end();    # Ensure no other elements exist.
    };

    is([], $check, 'All of the elements from bag found!');    # passes but shouldn't
};

like(
    $got,
    array {
        fail_events 'Ok' => sub {
            call pass => 0;
        };
    },
    "Bag check on empty array"
);

done_testing;