File: linkage-setters.t

package info (click to toggle)
libpandoc-elements-perl 0.38-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 732 kB
  • sloc: perl: 1,630; makefile: 15; sh: 1
file content (23 lines) | stat: -rw-r--r-- 675 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
use strict;
use warnings;
use Test::More 0.96;    # for subtests

use Pandoc::Elements qw[ attributes Str Link Image ];

my @tests = ( [ Link => \&Link ], [Image => \&Image], );

for my $test ( @tests ) {
    my ( $type, $constr ) = @$test;
    subtest $type => sub {
        my $e = $constr->( attributes {}, [ Str $type], [] );
        ok( ( can_ok( $e, 'name' ) and $e->name eq $type ), 'name' );
        for my $method ( qw[ url title ] ) {
            can_ok $e, $method;
            is $e->$method, "", "$method unset";
            is $e->$method( $method ), $method, "set $method";
            is $e->$method, $method, "$method set";
        }
    };
}

done_testing;