File: lineblock.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 (38 lines) | stat: -rw-r--r-- 1,117 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
33
34
35
36
37
38
use strict;
use Test::More;
use Pandoc::Elements;
use JSON;

# internal representation
my $lineblock = LineBlock [ [ Str "  foo"], [ Str "bar"], [ Str " baz"], ];
ok $lineblock->is_block, 'is_block';

{
    local $Pandoc::Elements::PANDOC_VERSION = '1.16';
    my $expect = {
        t => 'Para',
        c => [
            { 'c' => "\x{a0}\x{a0}foo", 't' => 'Str' },
            { 'c' => [],                't' => 'LineBreak' },
            { 'c' => "bar",             't' => 'Str' },
            { 'c' => [],                't' => 'LineBreak' },
            { 'c' => "\x{a0}baz",       't' => 'Str' }
        ]
    };
    is_deeply $expect, decode_json($lineblock->to_json), 'PANDOC_VERSION < 1.18';
}

{
    local $Pandoc::Elements::PANDOC_VERSION = '1.18';
    my $expect = {
        t => 'LineBlock',
        c => [
            [ { 'c' => "\x{a0}\x{a0}foo", 't' => 'Str' } ],
            [ { 'c' => "bar",             't' => 'Str' } ],
            [ { 'c' => "\x{a0}baz",       't' => 'Str' } ]
        ]
    };
    is_deeply $expect, decode_json($lineblock->to_json), 'PANDOC_VERSION >= 1.18';
}

done_testing;