File Coverage

blib/lib/Test/Data/Sah/Human.pm
Criterion Covered Total %
statement 29 29 100.0
branch 3 4 75.0
condition 3 7 42.8
subroutine 8 8 100.0
pod 1 1 100.0
total 44 49 89.8


line stmt bran cond sub pod time code
1              
2             use 5.010001;
3 2     2   186331 use strict;
  2         24  
4 2     2   9 use warnings;
  2         4  
  2         38  
5 2     2   9 use Test::More 0.98;
  2         2  
  2         55  
6 2     2   9  
  2         22  
  2         10  
7             use Data::Sah;
8 2     2   1364  
  2         8  
  2         91  
9             use Exporter qw(import);
10 2     2   13  
  2         4  
  2         452  
11             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
12             our $DATE = '2022-08-20'; # DATE
13             our $DIST = 'Data-Sah'; # DIST
14             our $VERSION = '0.912'; # VERSION
15              
16             our @EXPORT_OK = qw(test_human);
17              
18             my %args = @_;
19             subtest $args{name} // $args{result}, sub {
20 16     16 1 25248 my $sah = Data::Sah->new;
21             my $hc = $sah->get_compiler("human");
22 16     16   14405 my %hargs = (
23 16         501 schema => $args{schema},
24             lang => $args{lang},
25             %{ $args{compile_opts} // {} },
26             );
27 16   50     30 $hargs{format} //= "inline_text";
  16         80  
28             my $cd = $hc->compile(%hargs);
29 16   50     69  
30 16         61 if (defined $args{result}) {
31             if (ref($args{result}) eq 'Regexp') {
32 16 50       39 like($cd->{result}, $args{result}, 'result');
33 16 100       61 } else {
34 2         7 is($cd->{result}, $args{result}, 'result');
35             }
36 14         64 }
37             };
38             }
39 16   33     133  
40             1;
41             # ABSTRACT: Routines to test Data::Sah (human compiler)
42              
43              
44             =pod
45              
46             =encoding UTF-8
47              
48             =head1 NAME
49              
50             Test::Data::Sah::Human - Routines to test Data::Sah (human compiler)
51              
52             =head1 VERSION
53              
54             This document describes version 0.912 of Test::Data::Sah::Human (from Perl distribution Data-Sah), released on 2022-08-20.
55              
56             =head1 FUNCTIONS
57              
58             =head2 test_human(%args)
59              
60             =head1 HOMEPAGE
61              
62             Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>.
63              
64             =head1 SOURCE
65              
66             Source repository is at L<https://github.com/perlancar/perl-Data-Sah>.
67              
68             =head1 AUTHOR
69              
70             perlancar <perlancar@cpan.org>
71              
72             =head1 CONTRIBUTING
73              
74              
75             To contribute, you can send patches by email/via RT, or send pull requests on
76             GitHub.
77              
78             Most of the time, you don't need to build the distribution yourself. You can
79             simply modify the code, then test via:
80              
81             % prove -l
82              
83             If you want to build the distribution (e.g. to try to install it locally on your
84             system), you can install L<Dist::Zilla>,
85             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
86             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
87             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
88             that are considered a bug and can be reported to me.
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =head1 BUGS
98              
99             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah>
100              
101             When submitting a bug or request, please include a test-file or a
102             patch to an existing test-file that illustrates the bug or desired
103             feature.
104              
105             =cut