File: interface-implementation.t

package info (click to toggle)
libglib-object-introspection-perl 0.051-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 584 kB
  • sloc: ansic: 3,543; perl: 2,809; makefile: 9; sh: 3
file content (51 lines) | stat: -rw-r--r-- 864 bytes parent folder | download | duplicates (7)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env perl

BEGIN { require './t/inc/setup.pl' };

use strict;
use warnings;

plan tests => 7;

{
  package NoImplementation;
  use Glib::Object::Subclass
    'Glib::Object',
    interfaces => [ 'GI::Interface' ];
}

{
  my $foo = NoImplementation->new;
  local $@;
  eval { $foo->test_int8_in (23) };
  like ($@, qr/TEST_INT8_IN/);
}

{
  package GoodImplementation;
  use Glib::Object::Subclass
    'Glib::Object',
    interfaces => [ 'GI::Interface' ];
  sub TEST_INT8_IN {
    my ($self, $int8) = @_;
    Test::More::isa_ok ($self, __PACKAGE__);
    Test::More::isa_ok ($self, 'GI::Interface');
  }
}

{
  my $foo = GoodImplementation->new;
  $foo->test_int8_in (23);
  pass;
}

{
  package InheritedImplementation;
  use Glib::Object::Subclass 'GoodImplementation';
}

{
  my $foo = InheritedImplementation->new;
  $foo->test_int8_in (23);
  pass;
}