File: 14-lineno.t

package info (click to toggle)
libtext-microtemplate-perl 0.24-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 296 kB
  • sloc: perl: 1,725; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 621 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
use strict;
use warnings;
use Test::More;
use Text::MicroTemplate qw(:all);

my $mt = Text::MicroTemplate->new(
    template => <<'***',
L001 <?= L001
L002
L003
=> L004 <?
L005
L006
=><? L007 ?>
? L008
? L009
?= L010
<?#
?> L(fixme-lineno-after-multiline-comment-becomens-incorrect)012
***
);
my $code = $mt->code;

my @lines = split /\n/, $code;
for (my $i = 0; $i < @lines; ++$i) {
    my $ok = 1;
    while ($lines[$i] =~ /L([0-9]{3})/g) {
        my $expected = $1;
        $ok = undef
            if $expected != $i + 1;
    }
    ok $ok, "line @{[$i + 1]}";
    diag $lines[$i]
        unless $ok;
}

done_testing;