File: stringify.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 (32 lines) | stat: -rw-r--r-- 1,033 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
31
32
use strict;
use Test::More;
use Pandoc::Elements;

my $doc = Document { }, [
    Header(1,attributes {},[ Str 'hello', Code attributes {}, ', ' ]),
    BulletList [ [ Plain [ Str 'world', Space, Str '!' ] ] ],
];

$doc->meta->{foo} = MetaInlines [ Emph [ Str "FOO" ] ];
$doc->meta->{bar} = MetaString "BAR";
$doc->meta->{doz} = MetaMap { x => MetaList [ MetaInlines [ Str "DOZ" ] ] };

is $doc->meta->{foo}->string, 'FOO', 'stringify MetaInlines';
is $doc->meta->{bar}->string, 'BAR', 'stringify MetaString';
is $doc->meta->{doz}->string, 'DOZ', 'stringify MetaMap>MetaList>MetaInlines';

is $doc->string, 'hello, world !', 'stringify Document with metadata';

is LineBreak->string, ' ', 'LineBreak to space';
is RawBlock('html','<b>hi</hi>')->string,  '', 'RawBlock has no string';
is RawInline('html','<b>hi</hi>')->string,  '', 'RawInline has no string';
is Code(attributes {},'#!$')->string,  '#!$', 'Code has string';

is CodeBlock({}, 'Hi')->string, 'Hi', 'CodeBlock has string';

done_testing;

__DATA__
# hello`,`

* world !