File: ast.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 (30 lines) | stat: -rw-r--r-- 737 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
24
25
26
27
28
29
30
use strict;
use Test::More;
use Pandoc::Elements;

my $doc = Document { title => MetaInlines [ Str 'test' ] },
            [ Para [ Str 'test' ] ];

ok $doc->is_document, 'is_document';
is $doc->name, 'Document', 'name';
is_deeply $doc->content, [ Para [ Str 'test' ] ];
ok !$doc->is_block, 'is_block';
ok !$doc->is_inline, 'is_inline';
ok !$doc->is_meta, 'is_meta';

my $meta=$doc->meta;
ok $meta, '->meta';

ok $meta->{title}->is_meta, 'is_meta';
is $meta->{title}->name, 'MetaInlines', 'name';

my $para = $doc->{blocks}->[0];
is $para->name, 'Para', 'name';
is_deeply $para->content, [ Str 'test' ];
ok $para->is_block, 'is_block';
ok !$para->is_document, '!is_document';

$para->null;
is $para->name, 'Null', 'null';

done_testing;