Coveralls logob
Coveralls logo
  • Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

szabgab / perl5-markua-parser / 10

5 Mar 2018 - 15:52 coverage: 94.444% (-5.6%) from 100.0%
10

push

travis-ci

0a4c12791c9e13fda6624553bb72bc55?size=18&default=identiconszabgab
collect errors, parse every line in the input file

17 of 18 relevant lines covered (94.44%)

15.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.44
/lib/Markua/Parser.pm
1
package Markua::Parser;
2
use strict;
4×
3
use warnings;
4×
4
use Path::Tiny qw(path);
4×
5

6
our $VERSION = 0.01;
7

8
sub new {
9
    my ($class) = @_;
4×
10
    my $self = bless {}, $class;
4×
11
    return $self;
4×
12
}
13

14
sub parse_file {
15
    my ($self, $filename) = @_;
8×
16
    my @entries;
8×
17
    my @errors;
18
    my $cnt = 0;
8×
19
    for my $line (path($filename)->lines_utf8) {
8×
20
        $cnt++;
52×
21
        if ($line =~ /^(#{1,6}) (\S.*)/) {
52×
22
            push @entries, {
28×
23
                tag => 'h' . length($1),
24
                text => $2,
25
            };
26
            next;
28×
27
        }
28

29
        if ($line =~ /^\s*$/) {
24×
30
            next;
24×
31
        }
32

33
        push @errors, {
!
34
            row => $cnt,
35
            line => $line,
36
        }
37
    }
38
    return \@entries, \@errors;
8×
39
}
40

41

42
1;
43

Troubleshooting · Open an Issue · Sales · Support · ENTERPRISE · CAREERS · STATUS
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2023 Coveralls, Inc