File: Test2-Tools-Class.t

package info (click to toggle)
libtest-simple-perl 1.302211-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,972 kB
  • sloc: perl: 19,894; makefile: 7
file content (17 lines) | stat: -rw-r--r-- 458 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use Test2::Tools::Class;
use strict;
use warnings;

{
    package My::Object;
    use overload 'bool' => sub {$_[0]->{value}}
}

my $true_value  = bless {value => 1}, 'My::Object';
my $false_value = bless {value => 0}, 'My::Object';

isa_ok($true_value,  ['My::Object'], 'isa_ok when object overloads to true');
isa_ok($false_value, ['My::Object'], 'isa_ok when object overloads to false');

require Test2::Tools::Basic;
Test2::Tools::Basic::done_testing();